commit f324bee78e24 Author: Jeff Muizelaar Date: Wed Mar 7 11:54:01 2018 -0500 Bug 1438425 - Delete DocumentRenderer. r=jesup, r=jgilbert, a=RyanVM It is unused. --- dom/canvas/CanvasRenderingContext2D.cpp | 2 - dom/canvas/DocumentRendererChild.cpp | 94 --------------------------------- dom/canvas/DocumentRendererChild.h | 37 ------------- dom/canvas/DocumentRendererParent.cpp | 63 ---------------------- dom/canvas/DocumentRendererParent.h | 44 --------------- dom/canvas/WebGL2ContextState.cpp | 1 + dom/canvas/WebGLContextDraw.cpp | 1 + dom/canvas/WebGLFramebuffer.cpp | 3 ++ dom/canvas/WebGLObjectModel.h | 12 +++++ dom/canvas/WebGLProgram.cpp | 1 + dom/canvas/WebGLTransformFeedback.cpp | 1 + dom/canvas/moz.build | 7 --- dom/ipc/PBrowser.ipdl | 20 ------- dom/ipc/PDocumentRenderer.ipdl | 25 --------- dom/ipc/TabChild.cpp | 52 ------------------ dom/ipc/TabChild.h | 21 -------- dom/ipc/TabParent.cpp | 19 ------- dom/ipc/TabParent.h | 11 ---- dom/ipc/moz.build | 1 - 19 files changed, 19 insertions(+), 396 deletions(-) diff --git dom/canvas/CanvasRenderingContext2D.cpp dom/canvas/CanvasRenderingContext2D.cpp index 6c3f5878e724..f314f2022baf 100644 --- dom/canvas/CanvasRenderingContext2D.cpp +++ dom/canvas/CanvasRenderingContext2D.cpp @@ -91,8 +91,6 @@ #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/gfx/PatternHelpers.h" #include "mozilla/gfx/Swizzle.h" -#include "mozilla/ipc/DocumentRendererParent.h" -#include "mozilla/ipc/PDocumentRendererParent.h" #include "mozilla/layers/PersistentBufferProvider.h" #include "mozilla/MathAlgorithms.h" #include "mozilla/Preferences.h" diff --git dom/canvas/DocumentRendererChild.cpp dom/canvas/DocumentRendererChild.cpp deleted file mode 100644 index edfc4746a72c..000000000000 --- dom/canvas/DocumentRendererChild.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ipc/DocumentRendererChild.h" - -#include "base/basictypes.h" - -#include "gfx2DGlue.h" -#include "gfxContext.h" -#include "gfxPattern.h" -#include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" -#include "nsPIDOMWindow.h" -#include "nsIDOMWindow.h" -#include "nsIDocShell.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsComponentManagerUtils.h" -#include "nsCSSParser.h" -#include "nsPresContext.h" -#include "nsCOMPtr.h" -#include "nsColor.h" -#include "nsLayoutUtils.h" -#include "nsContentUtils.h" -#include "nsCSSValue.h" -#include "nsRuleNode.h" -#include "mozilla/gfx/Matrix.h" - -using namespace mozilla; -using namespace mozilla::gfx; -using namespace mozilla::ipc; - -DocumentRendererChild::DocumentRendererChild() -{} - -DocumentRendererChild::~DocumentRendererChild() -{} - -bool -DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window, - const nsRect& documentRect, - const mozilla::gfx::Matrix& transform, - const nsString& aBGColor, - uint32_t renderFlags, - bool flushLayout, - const nsIntSize& renderSize, - nsCString& data) -{ - if (flushLayout) - nsContentUtils::FlushLayoutForTree(window); - - RefPtr presContext; - if (window) { - nsIDocShell* docshell = window->GetDocShell(); - if (docshell) { - docshell->GetPresContext(getter_AddRefs(presContext)); - } - } - if (!presContext) - return false; - - nsCSSParser parser; - nsCSSValue bgColorValue; - if (!parser.ParseColorString(aBGColor, nullptr, 0, bgColorValue)) { - return false; - } - - nscolor bgColor; - if (!nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) { - return false; - } - - // Draw directly into the output array. - data.SetLength(renderSize.width * renderSize.height * 4); - - RefPtr dt = - Factory::CreateDrawTargetForData(gfxPlatform::GetPlatform()->GetSoftwareBackend(), - reinterpret_cast(data.BeginWriting()), - IntSize(renderSize.width, renderSize.height), - 4 * renderSize.width, - SurfaceFormat::B8G8R8A8); - if (!dt || !dt->IsValid()) { - gfxWarning() << "DocumentRendererChild::RenderDocument failed to Factory::CreateDrawTargetForData"; - return false; - } - RefPtr ctx = gfxContext::CreateOrNull(dt); - MOZ_ASSERT(ctx); // already checked the draw target above - ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform)); - - nsCOMPtr shell = presContext->PresShell(); - shell->RenderDocument(documentRect, renderFlags, bgColor, ctx); - - return true; -} diff --git dom/canvas/DocumentRendererChild.h dom/canvas/DocumentRendererChild.h deleted file mode 100644 index 80fe0ddf64bc..000000000000 --- dom/canvas/DocumentRendererChild.h +++ /dev/null @@ -1,37 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_DocumentRendererChild -#define mozilla_dom_DocumentRendererChild - -#include "gfxContext.h" -#include "mozilla/ipc/PDocumentRendererChild.h" -#include "nsString.h" - -class nsIDOMWindow; - -namespace mozilla { -namespace ipc { - -class DocumentRendererChild : public PDocumentRendererChild -{ -public: - DocumentRendererChild(); - virtual ~DocumentRendererChild(); - - bool RenderDocument(nsPIDOMWindowOuter* window, - const nsRect& documentRect, const gfx::Matrix& transform, - const nsString& bgcolor, - uint32_t renderFlags, bool flushLayout, - const nsIntSize& renderSize, nsCString& data); - -private: - - DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererChild); -}; - -} // namespace ipc -} // namespace mozilla - -#endif diff --git dom/canvas/DocumentRendererParent.cpp dom/canvas/DocumentRendererParent.cpp deleted file mode 100644 index 0783dee1ab79..000000000000 --- dom/canvas/DocumentRendererParent.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ipc/DocumentRendererParent.h" - -#include "gfx2DGlue.h" -#include "mozilla/gfx/2D.h" -#include "mozilla/gfx/PathHelpers.h" -#include "mozilla/RefPtr.h" -#include "nsICanvasRenderingContextInternal.h" - -using namespace mozilla; -using namespace mozilla::gfx; -using namespace mozilla::ipc; - -DocumentRendererParent::DocumentRendererParent() -{} - -DocumentRendererParent::~DocumentRendererParent() -{} - -void DocumentRendererParent::SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas, - gfxContext* ctx) -{ - mCanvas = aCanvas; - mCanvasContext = ctx; -} - -void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize, - const nsCString& aData) -{ - if (!mCanvas || !mCanvasContext) - return; - - DrawTarget* drawTarget = mCanvasContext->GetDrawTarget(); - Rect rect(0, 0, aSize.width, aSize.height); - MaybeSnapToDevicePixels(rect, *drawTarget, true); - RefPtr dataSurface = - Factory::CreateWrappingDataSourceSurface(reinterpret_cast(const_cast(aData).BeginWriting()), - aSize.width * 4, - IntSize(aSize.width, aSize.height), - SurfaceFormat::B8G8R8A8); - SurfacePattern pattern(dataSurface, ExtendMode::CLAMP); - drawTarget->FillRect(rect, pattern); - - gfxRect damageRect = mCanvasContext->UserToDevice(ThebesRect(rect)); - mCanvas->Redraw(damageRect); -} - -void -DocumentRendererParent::ActorDestroy(ActorDestroyReason aWhy) -{ - // Implement me! Bug 1005139 -} - -mozilla::ipc::IPCResult -DocumentRendererParent::Recv__delete__(const nsIntSize& renderedSize, - const nsCString& data) -{ - DrawToCanvas(renderedSize, data); - return IPC_OK(); -} diff --git dom/canvas/DocumentRendererParent.h dom/canvas/DocumentRendererParent.h deleted file mode 100644 index 7cfe5322795f..000000000000 --- dom/canvas/DocumentRendererParent.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_DocumentRendererParent -#define mozilla_dom_DocumentRendererParent - -#include "gfxContext.h" -#include "mozilla/ipc/PDocumentRendererParent.h" -#include "nsCOMPtr.h" -#include "nsString.h" - -class nsICanvasRenderingContextInternal; - -namespace mozilla { -namespace ipc { - -class DocumentRendererParent : public PDocumentRendererParent -{ -public: - DocumentRendererParent(); - virtual ~DocumentRendererParent(); - - void SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas, - gfxContext* ctx); - void DrawToCanvas(const nsIntSize& renderedSize, - const nsCString& aData); - - virtual void ActorDestroy(ActorDestroyReason aWhy) override; - - virtual mozilla::ipc::IPCResult Recv__delete__(const nsIntSize& renderedSize, - const nsCString& data) override; - -private: - nsCOMPtr mCanvas; - RefPtr mCanvasContext; - - DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererParent); -}; - -} // namespace ipc -} // namespace mozilla - -#endif diff --git dom/canvas/WebGL2ContextState.cpp dom/canvas/WebGL2ContextState.cpp index be0a7a3cbdea..e6283b12dd9e 100644 --- dom/canvas/WebGL2ContextState.cpp +++ dom/canvas/WebGL2ContextState.cpp @@ -7,6 +7,7 @@ #include "WebGL2Context.h" #include "GLContext.h" +#include "GLScreenBuffer.h" #include "WebGLBuffer.h" #include "WebGLContextUtils.h" #include "WebGLFramebuffer.h" diff --git dom/canvas/WebGLFramebuffer.cpp dom/canvas/WebGLFramebuffer.cpp index e5150d5ddd43..e2fdea239632 100644 --- dom/canvas/WebGLFramebuffer.cpp +++ dom/canvas/WebGLFramebuffer.cpp @@ -17,7 +17,9 @@ #include "WebGLContextUtils.h" #include "WebGLExtensions.h" #include "WebGLRenderbuffer.h" +#include "WebGLShader.h" #include "WebGLTexture.h" +#include "WebGLObjectModel.h" namespace mozilla { @@ -1990,6 +1992,7 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, } } + NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebGLFramebuffer, mDepthAttachment, mStencilAttachment, diff --git dom/canvas/WebGLObjectModel.h dom/canvas/WebGLObjectModel.h index e19d2fd8e44d..b18b790c036e 100644 --- dom/canvas/WebGLObjectModel.h +++ dom/canvas/WebGLObjectModel.h @@ -15,6 +15,7 @@ namespace mozilla { template class LinkedList; class WebGLContext; + //// // This class is a mixin for objects that are tied to a specific @@ -352,6 +353,16 @@ ImplCycleCollectionUnlink(mozilla::WebGLRefPtr& field) field = nullptr; } +template +inline void +ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, + mozilla::WebGLRefPtr& field, + const char* name, + uint32_t flags = 0) +{ + CycleCollectionNoteChild(callback, field.get(), name, flags); +} + template inline void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, @@ -362,4 +373,5 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, CycleCollectionNoteChild(callback, field.get(), name, flags); } + #endif diff --git dom/canvas/WebGLProgram.cpp dom/canvas/WebGLProgram.cpp index 365b8e178af8..9e48a240332c 100644 --- dom/canvas/WebGLProgram.cpp +++ dom/canvas/WebGLProgram.cpp @@ -17,6 +17,7 @@ #include "WebGLTransformFeedback.h" #include "WebGLUniformLocation.h" #include "WebGLValidateStrings.h" +#include "WebGLObjectModel.h" namespace mozilla { diff --git dom/canvas/moz.build dom/canvas/moz.build index ac4172318a7e..b33b09d7bc70 100644 --- dom/canvas/moz.build +++ dom/canvas/moz.build @@ -49,11 +49,6 @@ EXPORTS += [ 'nsICanvasRenderingContextInternal.h', ] -EXPORTS.mozilla.ipc += [ - 'DocumentRendererChild.h', - 'DocumentRendererParent.h', -] - EXPORTS.mozilla.dom += [ 'BasicRenderingContext2D.h', 'CanvasGradient.h', @@ -78,8 +73,6 @@ UNIFIED_SOURCES += [ 'CanvasRenderingContext2D.cpp', 'CanvasRenderingContextHelper.cpp', 'CanvasUtils.cpp', - 'DocumentRendererChild.cpp', - 'DocumentRendererParent.cpp', 'ImageBitmap.cpp', 'ImageBitmapColorUtils.cpp', 'ImageBitmapRenderingContext.cpp', diff --git dom/ipc/PBrowser.ipdl dom/ipc/PBrowser.ipdl index 5525931e914f..90f559063c4d 100644 --- dom/ipc/PBrowser.ipdl +++ dom/ipc/PBrowser.ipdl @@ -9,7 +9,6 @@ include protocol PColorPicker; include protocol PContent; include protocol PContentBridge; include protocol PDocAccessible; -include protocol PDocumentRenderer; include protocol PFilePicker; include protocol PIndexedDBPermissionRequest; include protocol PRenderFrame; @@ -110,7 +109,6 @@ nested(upto inside_cpow) sync protocol PBrowser manages PColorPicker; manages PDocAccessible; - manages PDocumentRenderer; manages PFilePicker; manages PIndexedDBPermissionRequest; manages PRenderFrame; @@ -698,24 +696,6 @@ child: async LoadRemoteScript(nsString aURL, bool aRunInGlobalScope); - /** - * Create a asynchronous request to render whatever document is - * loaded in the child when this message arrives. When the - * request finishes, PDocumentRenderer:__delete__ is sent back to - * this side to notify completion. - * - * |documentRect| is the area of the remote document to draw, - * transformed by |transform|. The rendered area will have the - * default background color |bgcolor|. |renderFlags| are the - * nsIPresShell::RenderDocument() flags to use on the remote side, - * and if true, |flushLayout| will do just that before rendering - * the document. The rendered image will be of size |renderSize|. - */ - async PDocumentRenderer(nsRect documentRect, Matrix transform, - nsString bgcolor, - uint32_t renderFlags, bool flushLayout, - IntSize renderSize); - /** * Sent by the chrome process when it no longer wants this remote * . The child side cleans up in response, then diff --git dom/ipc/PDocumentRenderer.ipdl dom/ipc/PDocumentRenderer.ipdl deleted file mode 100644 index bdaed45d7414..000000000000 --- dom/ipc/PDocumentRenderer.ipdl +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -include protocol PBrowser; - -include "mozilla/GfxMessageUtils.h"; - -using nsIntSize from "nsSize.h"; - -namespace mozilla { -namespace ipc { - -protocol PDocumentRenderer -{ - manager PBrowser; - -parent: - // Returns the width and height, in pixels, of the returned ARGB32 data. - async __delete__(nsIntSize renderedSize, nsCString data); -}; - -} // namespace ipc -} // namespace mozilla diff --git dom/ipc/TabChild.cpp dom/ipc/TabChild.cpp index 5a14fd9dc0ff..44f366056c2a 100644 --- dom/ipc/TabChild.cpp +++ dom/ipc/TabChild.cpp @@ -23,7 +23,6 @@ #include "mozilla/dom/PaymentRequestChild.h" #include "mozilla/dom/TelemetryScrollProbe.h" #include "mozilla/IMEStateManager.h" -#include "mozilla/ipc/DocumentRendererChild.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/layers/APZChild.h" #include "mozilla/layers/APZCCallbackHelper.h" @@ -2027,60 +2026,6 @@ TabChild::DeallocPDocAccessibleChild(a11y::PDocAccessibleChild* aChild) return true; } -PDocumentRendererChild* -TabChild::AllocPDocumentRendererChild(const nsRect& documentRect, - const mozilla::gfx::Matrix& transform, - const nsString& bgcolor, - const uint32_t& renderFlags, - const bool& flushLayout, - const nsIntSize& renderSize) -{ - return new DocumentRendererChild(); -} - -bool -TabChild::DeallocPDocumentRendererChild(PDocumentRendererChild* actor) -{ - delete actor; - return true; -} - -mozilla::ipc::IPCResult -TabChild::RecvPDocumentRendererConstructor(PDocumentRendererChild* actor, - const nsRect& documentRect, - const mozilla::gfx::Matrix& transform, - const nsString& bgcolor, - const uint32_t& renderFlags, - const bool& flushLayout, - const nsIntSize& renderSize) -{ - DocumentRendererChild *render = static_cast(actor); - - nsCOMPtr browser = do_QueryInterface(WebNavigation()); - if (!browser) - return IPC_OK(); // silently ignore - nsCOMPtr window; - if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) || - !window) - { - return IPC_OK(); // silently ignore - } - - nsCString data; - bool ret = render->RenderDocument(nsPIDOMWindowOuter::From(window), - documentRect, transform, - bgcolor, - renderFlags, flushLayout, - renderSize, data); - if (!ret) - return IPC_OK(); // silently ignore - - if (!PDocumentRendererChild::Send__delete__(actor, renderSize, data)) { - return IPC_FAIL_NO_REASON(this); - } - return IPC_OK(); -} - PColorPickerChild* TabChild::AllocPColorPickerChild(const nsString&, const nsString&) { diff --git dom/ipc/TabChild.h dom/ipc/TabChild.h index af01a50542ac..1b1e580b29e6 100644 --- dom/ipc/TabChild.h +++ dom/ipc/TabChild.h @@ -456,27 +456,6 @@ public: virtual bool DeallocPDocAccessibleChild(PDocAccessibleChild*) override; - virtual PDocumentRendererChild* - AllocPDocumentRendererChild(const nsRect& aDocumentRect, - const gfx::Matrix& aTransform, - const nsString& aBggcolor, - const uint32_t& aRenderFlags, - const bool& aFlushLayout, - const nsIntSize& arenderSize) override; - - virtual bool - DeallocPDocumentRendererChild(PDocumentRendererChild* aCctor) override; - - virtual mozilla::ipc::IPCResult - RecvPDocumentRendererConstructor(PDocumentRendererChild* aActor, - const nsRect& aDocumentRect, - const gfx::Matrix& aTransform, - const nsString& aBgcolor, - const uint32_t& aRenderFlags, - const bool& aFlushLayout, - const nsIntSize& aRenderSize) override; - - virtual PColorPickerChild* AllocPColorPickerChild(const nsString& aTitle, const nsString& aInitialColor) override; diff --git dom/ipc/TabParent.cpp dom/ipc/TabParent.cpp index e6eac09db4aa..8468343b8930 100644 --- dom/ipc/TabParent.cpp +++ dom/ipc/TabParent.cpp @@ -26,7 +26,6 @@ #include "mozilla/gfx/GPUProcessManager.h" #include "mozilla/Hal.h" #include "mozilla/IMEStateManager.h" -#include "mozilla/ipc/DocumentRendererParent.h" #include "mozilla/jsipc/CrossProcessObjectWrappers.h" #include "mozilla/layers/AsyncDragMetrics.h" #include "mozilla/layers/InputAPZContext.h" @@ -982,24 +981,6 @@ TabParent::GetTopLevelDocAccessible() const return nullptr; } -PDocumentRendererParent* -TabParent::AllocPDocumentRendererParent(const nsRect& documentRect, - const gfx::Matrix& transform, - const nsString& bgcolor, - const uint32_t& renderFlags, - const bool& flushLayout, - const nsIntSize& renderSize) -{ - return new DocumentRendererParent(); -} - -bool -TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor) -{ - delete actor; - return true; -} - PFilePickerParent* TabParent::AllocPFilePickerParent(const nsString& aTitle, const int16_t& aMode) { diff --git dom/ipc/TabParent.h dom/ipc/TabParent.h index 1f75d188d92e..0472dad56e97 100644 --- dom/ipc/TabParent.h +++ dom/ipc/TabParent.h @@ -468,17 +468,6 @@ public: const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); - virtual PDocumentRendererParent* - AllocPDocumentRendererParent(const nsRect& documentRect, - const gfx::Matrix& transform, - const nsString& bgcolor, - const uint32_t& renderFlags, - const bool& flushLayout, - const nsIntSize& renderSize) override; - - virtual bool - DeallocPDocumentRendererParent(PDocumentRendererParent* actor) override; - virtual PFilePickerParent* AllocPFilePickerParent(const nsString& aTitle, const int16_t& aMode) override; diff --git dom/ipc/moz.build dom/ipc/moz.build index fa7d4a9ef549..4880a69f00ec 100644 --- dom/ipc/moz.build +++ dom/ipc/moz.build @@ -91,7 +91,6 @@ IPDL_SOURCES += [ 'PContentPermission.ipdlh', 'PContentPermissionRequest.ipdl', 'PCycleCollectWithLogs.ipdl', - 'PDocumentRenderer.ipdl', 'PFilePicker.ipdl', 'PPluginWidget.ipdl', 'PProcessHangMonitor.ipdl',