author | Phil Ringnalda <philringnalda@gmail.com> |
Sun, 08 Dec 2013 18:43:45 -0800 | |
changeset 159459 | 45193a6d79940ecb744556386d47aa8a7fbc37f1 |
parent 159458 | 6dd0a6cb9ab335b8aefbd4a21cf991d3e8ee4f68 |
child 159460 | e5edb615c64feb24c70fb512656fd79786b5ce85 |
push id | 37313 |
push user | philringnalda@gmail.com |
push date | Mon, 09 Dec 2013 02:45:39 +0000 |
treeherder | mozilla-inbound@45193a6d7994 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 946958, 865033 |
milestone | 28.0a1 |
backs out | 6dd0a6cb9ab335b8aefbd4a21cf991d3e8ee4f68 498152aec5b1eadb68ad76e9d9b9f95cef5e97f5 7d035322f51d807c13f79aeb0523b1c19ca6a45a 99f8ad7561ef9c6e3a06da9a27163c32fecb5e57 4639c5abea80c31958a6f199dac92719e57e1f62 9d1a4d83eccfd6e7c19b943564e0531cbe65c33e 41839e4026bc9b6c34dc07c678104069cb955c34 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -426,16 +426,17 @@ public: * Call before rendering begins to ensure the compositor is ready to * composite. Returns false if rendering should be aborted. */ virtual bool Ready() { return true; } // XXX I expect we will want to move mWidget into this class and implement // these methods properly. virtual nsIWidget* GetWidget() const { return nullptr; } + virtual const nsIntSize& GetWidgetSize() = 0; // Call before and after any rendering not done by this compositor but which // might affect the compositor's internal state or the state of any APIs it // uses. For example, internal GL state. virtual void SaveState() {} virtual void RestoreState() {} /**
--- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -128,16 +128,25 @@ LayerManager::CreateOptimalMaskSurface(c TemporaryRef<DrawTarget> LayerManager::CreateDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) { return gfxPlatform::GetPlatform()-> CreateOffscreenCanvasDrawTarget(aSize, aFormat); } +TextureFactoryIdentifier +LayerManager::GetTextureFactoryIdentifier() +{ + //TODO[nrc] make pure virtual when all layer managers use Compositor + NS_ERROR("Should have been overridden"); + return TextureFactoryIdentifier(); +} + + #ifdef DEBUG void LayerManager::Mutated(Layer* aLayer) { } #endif // DEBUG already_AddRefed<ImageContainer>
--- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -433,16 +433,22 @@ public: */ virtual TemporaryRef<mozilla::gfx::DrawTarget> CreateDrawTarget(const mozilla::gfx::IntSize &aSize, mozilla::gfx::SurfaceFormat aFormat); virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; } /** + * Returns a TextureFactoryIdentifier which describes properties of the backend + * used to decide what kind of texture and buffer clients to create + */ + virtual TextureFactoryIdentifier GetTextureFactoryIdentifier(); + + /** * returns the maximum texture size on this layer backend, or INT32_MAX * if there is no maximum */ virtual int32_t GetMaxTextureSize() const = 0; /** * Return the name of the layer manager's backend. */
--- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -215,16 +215,17 @@ CreateBasicDeprecatedTextureHost(Surface } result->SetFlags(aTextureFlags); return result.forget(); } BasicCompositor::BasicCompositor(nsIWidget *aWidget) : mWidget(aWidget) + , mWidgetSize(-1, -1) { MOZ_COUNT_CTOR(BasicCompositor); sBackend = LAYERS_BASIC; } BasicCompositor::~BasicCompositor() { MOZ_COUNT_DTOR(BasicCompositor); @@ -534,16 +535,17 @@ BasicCompositor::BeginFrame(const nsIntR const gfxMatrix& aTransform, const gfx::Rect& aRenderBounds, gfx::Rect *aClipRectOut /* = nullptr */, gfx::Rect *aRenderBoundsOut /* = nullptr */) { nsIntRect intRect; mWidget->GetClientBounds(intRect); Rect rect = Rect(0, 0, intRect.width, intRect.height); + mWidgetSize = intRect.Size(); nsIntRect invalidRect = aInvalidRegion.GetBounds(); mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height); mInvalidRegion = aInvalidRegion; if (aRenderBoundsOut) { *aRenderBoundsOut = Rect(); }
--- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -114,16 +114,20 @@ public: virtual void PrepareViewport(const gfx::IntSize& aSize, const gfxMatrix& aWorldTransform) MOZ_OVERRIDE { } virtual void NotifyLayersTransaction() MOZ_OVERRIDE { } virtual const char* Name() const { return "Basic"; } virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; } + virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE + { + return mWidgetSize; + } gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; } private: // Widget associated with this compositor nsIWidget *mWidget; nsIntSize mWidgetSize;
--- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -68,17 +68,17 @@ public: virtual already_AddRefed<ThebesLayer> CreateThebesLayer(); virtual already_AddRefed<ThebesLayer> CreateThebesLayerWithHint(ThebesLayerCreationHint aHint); virtual already_AddRefed<ContainerLayer> CreateContainerLayer(); virtual already_AddRefed<ImageLayer> CreateImageLayer(); virtual already_AddRefed<CanvasLayer> CreateCanvasLayer(); virtual already_AddRefed<ColorLayer> CreateColorLayer(); virtual already_AddRefed<RefLayer> CreateRefLayer(); - TextureFactoryIdentifier GetTextureFactoryIdentifier() + virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE { return mForwarder->GetTextureFactoryIdentifier(); } virtual void FlushRendering() MOZ_OVERRIDE; void SendInvalidRegion(const nsIntRegion& aRegion); virtual uint32_t StartFrameTimeRecording(int32_t aBufferSize) MOZ_OVERRIDE;
--- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -198,17 +198,16 @@ LayerManagerComposite::EndEmptyTransacti } void LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback, void* aCallbackData, EndTransactionFlags aFlags) { NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?"); - NS_ASSERTION(!aCallback && !aCallbackData, "Not expecting callbacks here"); mInTransaction = false; if (!mIsCompositorReady) { return; } mIsCompositorReady = false; #ifdef MOZ_LAYERS_HAVE_LOG @@ -236,17 +235,23 @@ LayerManagerComposite::EndTransaction(Dr // properties. mRoot->ApplyPendingUpdatesToSubtree(); } // The results of our drawing always go directly into a pixel buffer, // so we don't need to pass any global transform here. mRoot->ComputeEffectiveTransforms(gfx3DMatrix()); + mThebesLayerCallback = aCallback; + mThebesLayerCallbackData = aCallbackData; + Render(); + + mThebesLayerCallback = nullptr; + mThebesLayerCallbackData = nullptr; } mCompositor->SetTargetContext(nullptr); #ifdef MOZ_LAYERS_HAVE_LOG Log(); MOZ_LAYERS_LOG(("]----- EndTransaction")); #endif @@ -297,17 +302,17 @@ LayerManagerComposite::CreateCanvasLayer LayerComposite* LayerManagerComposite::RootLayer() const { if (mDestroyed) { NS_WARNING("Call on destroyed layer manager"); return nullptr; } - return ToLayerComposite(mRoot); + return static_cast<LayerComposite*>(mRoot->ImplData()); } static uint16_t sFrameCount = 0; void LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds) { if (!gfxPlatform::DrawFrameCounter()) { return; @@ -713,17 +718,17 @@ LayerManagerComposite::AutoAddMaskEffect EffectChain& aEffects, bool aIs3D) : mCompositable(nullptr) { if (!aMaskLayer) { return; } - mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost(); + mCompositable = static_cast<LayerComposite*>(aMaskLayer->ImplData())->GetCompositableHost(); if (!mCompositable) { NS_WARNING("Mask layer with no compositable host"); return; } gfx::Matrix4x4 transform; ToMatrix4x4(aMaskLayer->GetEffectiveTransform(), transform); mCompositable->AddMaskEffect(aEffects, transform, aIs3D); @@ -776,23 +781,54 @@ void LayerComposite::Destroy() { if (!mDestroyed) { mDestroyed = true; CleanupResources(); } } +const nsIntSize& +LayerManagerComposite::GetWidgetSize() +{ + return mCompositor->GetWidgetSize(); +} + +void +LayerManagerComposite::SetCompositorID(uint32_t aID) +{ + NS_ASSERTION(mCompositor, "No compositor"); + mCompositor->SetCompositorID(aID); +} + +void +LayerManagerComposite::NotifyShadowTreeTransaction() +{ + mCompositor->NotifyLayersTransaction(); +} + bool LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return mCompositor->CanUseCanvasLayerForSize(gfx::IntSize(aSize.width, aSize.height)); } +TextureFactoryIdentifier +LayerManagerComposite::GetTextureFactoryIdentifier() +{ + return mCompositor->GetTextureFactoryIdentifier(); +} + +int32_t +LayerManagerComposite::GetMaxTextureSize() const +{ + return mCompositor->GetMaxTextureSize(); +} + #ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS /*static*/ bool LayerManagerComposite::SupportsDirectTexturing() { return false; }
--- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -105,31 +105,30 @@ public: virtual void BeginTransaction() MOZ_OVERRIDE; virtual void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE { MOZ_CRASH("Use BeginTransactionWithDrawTarget"); } void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget); + void NotifyShadowTreeTransaction(); + virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE; virtual void EndTransaction(DrawThebesLayerCallback aCallback, void* aCallbackData, EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE; virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; } - // XXX[nrc]: never called, we should move this logic to ClientLayerManager - // (bug 946926). virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE; - virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE - { - MOZ_CRASH("Call on compositor, not LayerManagerComposite"); - } + virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE; + + virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE; virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE; virtual already_AddRefed<ThebesLayer> CreateThebesLayer() MOZ_OVERRIDE; virtual already_AddRefed<ContainerLayer> CreateContainerLayer() MOZ_OVERRIDE; virtual already_AddRefed<ImageLayer> CreateImageLayer() MOZ_OVERRIDE; virtual already_AddRefed<ColorLayer> CreateColorLayer() MOZ_OVERRIDE; virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() MOZ_OVERRIDE; @@ -137,26 +136,34 @@ public: already_AddRefed<ContainerLayerComposite> CreateContainerLayerComposite(); already_AddRefed<ImageLayerComposite> CreateImageLayerComposite(); already_AddRefed<ColorLayerComposite> CreateColorLayerComposite(); already_AddRefed<CanvasLayerComposite> CreateCanvasLayerComposite(); already_AddRefed<RefLayerComposite> CreateRefLayerComposite(); virtual LayersBackend GetBackendType() MOZ_OVERRIDE { - MOZ_CRASH("Shouldn't be called for composited layer manager"); + return LAYERS_NONE; } virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE { - MOZ_CRASH("Shouldn't be called for composited layer manager"); + MOZ_ASSERT(false, "Shouldn't be called for composited layer manager"); + name.AssignLiteral("Composite"); } virtual already_AddRefed<gfxASurface> CreateOptimalMaskSurface(const gfxIntSize &aSize) MOZ_OVERRIDE; + + DrawThebesLayerCallback GetThebesLayerCallback() const + { return mThebesLayerCallback; } + + void* GetThebesLayerCallbackData() const + { return mThebesLayerCallbackData; } + virtual const char* Name() const MOZ_OVERRIDE { return ""; } enum WorldTransforPolicy { ApplyWorldTransform, DontApplyWorldTransform }; /** @@ -183,19 +190,21 @@ public: CompositableHost* mCompositable; }; /** * Creates a DrawTarget which is optimized for inter-operating with this * layermanager. */ virtual TemporaryRef<mozilla::gfx::DrawTarget> - CreateDrawTarget(const mozilla::gfx::IntSize& aSize, + CreateDrawTarget(const mozilla::gfx::IntSize &aSize, mozilla::gfx::SurfaceFormat aFormat) MOZ_OVERRIDE; + const nsIntSize& GetWidgetSize(); + /** * Calculates the 'completeness' of the rendering that intersected with the * screen on the last render. This is only useful when progressive tile * drawing is enabled, otherwise this will always return 1.0. * This function's expense scales with the size of the layer tree and the * complexity of individual layers' valid regions. */ float ComputeRenderIntegrity(); @@ -203,16 +212,18 @@ public: /** * returns true if PlatformAllocBuffer will return a buffer that supports * direct texturing */ static bool SupportsDirectTexturing(); static void PlatformSyncBeforeReplyUpdate(); + void SetCompositorID(uint32_t aID); + void AddInvalidRegion(const nsIntRegion& aRegion) { mInvalidRegion.Or(mInvalidRegion, aRegion); } Compositor* GetCompositor() const { return mCompositor; @@ -229,17 +240,17 @@ public: { mDebugOverlayWantsNextFrame = aVal; } private: /** Region we're clipping our current drawing to. */ nsIntRegion mClippingRegion; nsIntRect mRenderBounds; /** Current root layer. */ - LayerComposite* RootLayer() const; + LayerComposite *RootLayer() const; /** * Recursive helper method for use by ComputeRenderIntegrity. Subtracts * any incomplete rendering on aLayer from aScreenRegion. Any low-precision * rendering is included in aLowPrecisionScreenRegion. aTransform is the * accumulated transform of intermediate surfaces beneath aLayer. */ static void ComputeRenderIntegrityInternal(Layer* aLayer, @@ -259,16 +270,20 @@ private: void WorldTransformRect(nsIntRect& aRect); RefPtr<Compositor> mCompositor; /** Our more efficient but less powerful alter ego, if one is available. */ nsRefPtr<Composer2D> mComposer2D; + /* Thebes layer callbacks; valid at the end of a transaciton, + * while rendering */ + DrawThebesLayerCallback mThebesLayerCallback; + void *mThebesLayerCallbackData; gfxMatrix mWorldMatrix; bool mInTransaction; bool mIsCompositorReady; nsIntRegion mInvalidRegion; nsAutoPtr<LayerProperties> mClonedLayerTreeProperties; bool mDebugOverlayWantsNextFrame; };
--- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -134,16 +134,24 @@ public: #ifdef MOZ_DUMP_PAINTING virtual const char* Name() const MOZ_OVERRIDE { return "Direct3D 11"; } #endif virtual void NotifyLayersTransaction() MOZ_OVERRIDE { } virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; } + virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE + { + NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. " + "You should not do that outside of BeginFrame, so the best we can do is return " + "the last size we got, that might not be up to date. So you probably shouldn't " + "use this method."); + return mSize; + } ID3D11Device* GetDevice() { return mDevice; } private: // ensure mSize is up to date with respect to mWidget void EnsureSize(); void VerifyBufferSize(); void UpdateRenderTarget();
--- a/gfx/layers/d3d9/CompositorD3D9.h +++ b/gfx/layers/d3d9/CompositorD3D9.h @@ -81,16 +81,24 @@ public: #ifdef MOZ_DUMP_PAINTING virtual const char* Name() const MOZ_OVERRIDE { return "Direct3D9"; } #endif virtual void NotifyLayersTransaction() MOZ_OVERRIDE {} virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; } + virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE + { + NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. " + "You should not do that outside of BeginFrame, so the best we can do is return " + "the last size we got, that might not be up to date. So you probably shouldn't " + "use this method."); + return mSize; + } IDirect3DDevice9* device() const { return mDeviceManager ? mDeviceManager->device() : nullptr; }
new file mode 100644 --- /dev/null +++ b/gfx/layers/ipc/CompositorCocoaWidgetHelper.cpp @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 ts=2 et tw=80 : */ +/* 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 "CompositorParent.h" +#include "CompositorCocoaWidgetHelper.h" +#include "nsDebug.h" + +namespace mozilla { +namespace layers { +namespace compositor { + +LayerManagerComposite* +GetLayerManager(CompositorParent* aParent) +{ + return aParent->GetLayerManager(); +} + + +} +} +}
new file mode 100644 --- /dev/null +++ b/gfx/layers/ipc/CompositorCocoaWidgetHelper.h @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set sw=4 ts=8 et tw=80 : */ +/* 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_layers_CompositorCocoaWidgetHelper_h +#define mozilla_layers_CompositorCocoaWidgetHelper_h + +// Note we can't include IPDL-generated headers here, since this file is being +// used as a workaround for Bug 719036. + +namespace mozilla { +namespace layers { + +class CompositorParent; +class LayerManagerComposite; + +namespace compositor { + +// Needed when we cannot directly include CompositorParent.h since it includes +// an IPDL-generated header (e.g. in widget/cocoa/nsChildView.mm; see Bug 719036). +LayerManagerComposite* GetLayerManager(CompositorParent* aParent); + +} +} +} +#endif // mozilla_layers_CompositorCocoaWidgetHelper_h +
--- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -57,17 +57,16 @@ using namespace mozilla::ipc; using namespace mozilla::gfx; using namespace std; namespace mozilla { namespace layers { CompositorParent::LayerTreeState::LayerTreeState() : mParent(nullptr) - , mLayerManager(nullptr) { } typedef map<uint64_t, CompositorParent::LayerTreeState> LayerTreeMap; static LayerTreeMap sIndirectLayerTrees; // FIXME/bug 774386: we're assuming that there's only one // CompositorParent, but that's not always true. This assumption only @@ -233,17 +232,16 @@ CompositorParent::~CompositorParent() void CompositorParent::Destroy() { NS_ABORT_IF_FALSE(ManagedPLayerTransactionParent().Length() == 0, "CompositorParent destroyed before managed PLayerTransactionParent"); // Ensure that the layer manager is destructed on the compositor thread. mLayerManager = nullptr; - mCompositor = nullptr; mCompositionManager = nullptr; mApzcTreeManager->ClearTree(); mApzcTreeManager = nullptr; sIndirectLayerTrees.erase(mRootLayerTreeID); } void CompositorParent::ForceIsFirstPaint() @@ -260,22 +258,20 @@ CompositorParent::RecvWillStop() // Ensure that the layer manager is destroyed before CompositorChild. if (mLayerManager) { for (LayerTreeMap::iterator it = sIndirectLayerTrees.begin(); it != sIndirectLayerTrees.end(); it++) { LayerTreeState* lts = &it->second; if (lts->mParent == this) { mLayerManager->ClearCachedResources(lts->mRoot); - lts->mLayerManager = nullptr; } } mLayerManager->Destroy(); mLayerManager = nullptr; - mCompositor = nullptr; mCompositionManager = nullptr; } return true; } bool CompositorParent::RecvStop() @@ -370,19 +366,17 @@ void CompositorParent::ActorDestroy(ActorDestroyReason why) { mPaused = true; RemoveCompositor(mCompositorID); if (mLayerManager) { mLayerManager->Destroy(); mLayerManager = nullptr; - sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = nullptr; mCompositionManager = nullptr; - mCompositor = nullptr; } } void CompositorParent::ScheduleRenderOnCompositorThread() { CancelableTask *renderTask = NewRunnableMethod(this, &CompositorParent::ScheduleComposition); @@ -395,32 +389,32 @@ CompositorParent::PauseComposition() NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(), "PauseComposition() can only be called on the compositor thread"); MonitorAutoLock lock(mPauseCompositionMonitor); if (!mPaused) { mPaused = true; - mCompositor->Pause(); + mLayerManager->GetCompositor()->Pause(); } // if anyone's waiting to make sure that composition really got paused, tell them lock.NotifyAll(); } void CompositorParent::ResumeComposition() { NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(), "ResumeComposition() can only be called on the compositor thread"); MonitorAutoLock lock(mResumeCompositionMonitor); - if (!mCompositor->Resume()) { + if (!mLayerManager->GetCompositor()->Resume()) { #ifdef MOZ_WIDGET_ANDROID // We can't get a surface. This could be because the activity changed between // the time resume was scheduled and now. __android_log_print(ANDROID_LOG_INFO, "CompositorParent", "Unable to renew compositor surface; remaining in paused state"); #endif lock.NotifyAll(); return; } @@ -441,18 +435,18 @@ CompositorParent::ForceComposition() ScheduleRenderOnCompositorThread(); } void CompositorParent::SetEGLSurfaceSize(int width, int height) { NS_ASSERTION(mUseExternalSurfaceSize, "Compositor created without UseExternalSurfaceSize provided"); mEGLSurfaceSize.SizeTo(width, height); - if (mCompositor) { - mCompositor->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height)); + if (mLayerManager) { + mLayerManager->GetCompositor()->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height)); } } void CompositorParent::ResumeCompositionAndResize(int width, int height) { SetEGLSurfaceSize(width, height); ResumeComposition(); @@ -504,17 +498,17 @@ void CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint) { if (mApzcTreeManager && mLayerManager && mLayerManager->GetRoot()) { AutoResolveRefLayers resolve(mCompositionManager); mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(), aIsFirstPaint, aId); - mCompositor->NotifyLayersTransaction(); + mLayerManager->AsLayerManagerComposite()->NotifyShadowTreeTransaction(); } ScheduleComposition(); } // Used when layout.frame_rate is -1. Needs to be kept in sync with // DEFAULT_FRAME_RATE in nsRefreshDriver.cpp. static const int32_t kDefaultFrameRate = 60; @@ -698,51 +692,53 @@ CompositorParent::ShadowLayersUpdated(La if (root) { SetShadowProperties(root); if (mIsTesting) { mCompositionManager->TransformShadowTree(mTestTime); } } ScheduleComposition(); - mCompositor->NotifyLayersTransaction(); + mLayerManager->NotifyShadowTreeTransaction(); } void CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints) { NS_ASSERTION(!mLayerManager, "Already initialised mLayerManager"); for (size_t i = 0; i < aBackendHints.Length(); ++i) { - RefPtr<Compositor> compositor; + RefPtr<LayerManagerComposite> layerManager; if (aBackendHints[i] == LAYERS_OPENGL) { - compositor = new CompositorOGL(mWidget, - mEGLSurfaceSize.width, - mEGLSurfaceSize.height, - mUseExternalSurfaceSize); + layerManager = + new LayerManagerComposite(new CompositorOGL(mWidget, + mEGLSurfaceSize.width, + mEGLSurfaceSize.height, + mUseExternalSurfaceSize)); } else if (aBackendHints[i] == LAYERS_BASIC) { - compositor = new BasicCompositor(mWidget); + layerManager = + new LayerManagerComposite(new BasicCompositor(mWidget)); #ifdef XP_WIN } else if (aBackendHints[i] == LAYERS_D3D11) { - compositor = new CompositorD3D11(mWidget); + layerManager = + new LayerManagerComposite(new CompositorD3D11(mWidget)); } else if (aBackendHints[i] == LAYERS_D3D9) { - compositor = new CompositorD3D9(this, mWidget); + layerManager = + new LayerManagerComposite(new CompositorD3D9(this, mWidget)); #endif } - MOZ_ASSERT(compositor, "Passed invalid backend hint"); + if (!layerManager) { + continue; + } - compositor->SetCompositorID(mCompositorID); - RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor); + layerManager->SetCompositorID(mCompositorID); if (layerManager->Initialize()) { mLayerManager = layerManager; - MOZ_ASSERT(compositor); - mCompositor = compositor; - sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = layerManager; return; } } } PLayerTransactionParent* CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints, const uint64_t& aId, @@ -764,17 +760,17 @@ CompositorParent::AllocPLayerTransaction LayerTransactionParent* p = new LayerTransactionParent(nullptr, this, 0); p->AddIPDLReference(); return p; } mCompositionManager = new AsyncCompositionManager(mLayerManager); *aSuccess = true; - *aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier(); + *aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier(); LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, 0); p->AddIPDLReference(); return p; } bool CompositorParent::DeallocPLayerTransactionParent(PLayerTransactionParent* actor) { @@ -920,27 +916,16 @@ CompositorParent::GetAPZCTreeManager(uin { const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aLayersId); if (state && state->mParent) { return state->mParent->mApzcTreeManager; } return nullptr; } -float -CompositorParent::ComputeRenderIntegrity() -{ - if (mLayerManager) { - return mLayerManager->ComputeRenderIntegrity(); - } - - return 1.0f; -} - - /** * This class handles layer updates pushed directly from child * processes to the compositor thread. It's associated with a * CompositorParent on the compositor thread. While it uses the * PCompositor protocol to manage these updates, it doesn't actually * drive compositing itself. For that it hands off work to the * CompositorParent it's associated with. */ @@ -1081,19 +1066,19 @@ CrossProcessCompositorParent::ActorDestr PLayerTransactionParent* CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>&, const uint64_t& aId, TextureFactoryIdentifier* aTextureFactoryIdentifier, bool *aSuccess) { MOZ_ASSERT(aId != 0); - if (sIndirectLayerTrees[aId].mLayerManager) { - LayerManagerComposite* lm = sIndirectLayerTrees[aId].mLayerManager; - *aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier(); + if (sIndirectLayerTrees[aId].mParent) { + LayerManagerComposite* lm = sIndirectLayerTrees[aId].mParent->GetLayerManager(); + *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId); p->AddIPDLReference(); return p; } NS_WARNING("Created child without a matching parent?"); // XXX: should be false, but that causes us to fail some tests on Mac w/ OMTC.
--- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -42,17 +42,16 @@ namespace mozilla { namespace gfx { class DrawTarget; } namespace layers { class APZCTreeManager; class AsyncCompositionManager; -class Compositor; class LayerManagerComposite; class LayerTransactionParent; struct ScopedLayerTreeRegistration { ScopedLayerTreeRegistration(uint64_t aLayersId, Layer* aRoot, GeckoContentController* aController); @@ -103,16 +102,18 @@ public: * be called by the widget code when it loses its viewport information * (or for whatever reason wants to refresh the viewport information). * The information refresh happens because the compositor will call * SetFirstPaintViewport on the next frame of composition. */ void ForceIsFirstPaint(); void Destroy(); + LayerManagerComposite* GetLayerManager() { return mLayerManager; } + void NotifyChildCreated(uint64_t aChild); void AsyncRender(); // Can be called from any thread void ScheduleRenderOnCompositorThread(); void SchedulePauseOnCompositorThread(); /** @@ -197,29 +198,26 @@ public: static void StartUpWithExistingThread(MessageLoop* aMsgLoop, PlatformThreadId aThreadID); struct LayerTreeState { LayerTreeState(); nsRefPtr<Layer> mRoot; nsRefPtr<GeckoContentController> mController; CompositorParent* mParent; - LayerManagerComposite* mLayerManager; TargetConfig mTargetConfig; }; /** * Lookup the indirect shadow tree for |aId| and return it if it * exists. Otherwise null is returned. This must only be called on * the compositor thread. */ static const LayerTreeState* GetIndirectShadowTree(uint64_t aId); - float ComputeRenderIntegrity(); - /** * Tell all CompositorParents to update their last refresh to aTime and sample * animations at this time stamp. If aIsTesting is true, the * CompositorParents will become "paused" and continue sampling animations at * this time stamp until this function is called again with aIsTesting set to * false. */ static void SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting); @@ -292,17 +290,16 @@ private: /** * Return true if current state allows compositing, that is * finishing a layers transaction. */ bool CanComposite(); nsRefPtr<LayerManagerComposite> mLayerManager; - nsRefPtr<Compositor> mCompositor; RefPtr<AsyncCompositionManager> mCompositionManager; nsIWidget* mWidget; CancelableTask *mCurrentCompositeTask; TimeStamp mLastCompose; TimeStamp mTestTime; bool mIsTesting; #ifdef COMPOSITOR_PERFORMANCE_WARNING TimeStamp mExpectedComposeTime;
--- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -123,16 +123,17 @@ EXPORTS.mozilla.layers += [ 'D3D9SurfaceImage.h', 'Effects.h', 'ImageDataSerializer.h', 'ipc/AsyncPanZoomController.h', 'ipc/Axis.h', 'ipc/CompositableForwarder.h', 'ipc/CompositableTransactionParent.h', 'ipc/CompositorChild.h', + 'ipc/CompositorCocoaWidgetHelper.h', 'ipc/CompositorParent.h', 'ipc/GeckoContentController.h', 'ipc/GestureEventListener.h', 'ipc/ImageBridgeChild.h', 'ipc/ImageBridgeParent.h', 'ipc/ISurfaceAllocator.h', 'ipc/LayerTransactionChild.h', 'ipc/LayerTransactionParent.h', @@ -234,16 +235,17 @@ UNIFIED_SOURCES += [ 'CopyableCanvasLayer.cpp', 'Effects.cpp', 'ImageDataSerializer.cpp', 'ImageLayers.cpp', 'ipc/AsyncPanZoomController.cpp', 'ipc/Axis.cpp', 'ipc/CompositableTransactionParent.cpp', 'ipc/CompositorChild.cpp', + 'ipc/CompositorCocoaWidgetHelper.cpp', 'ipc/CompositorParent.cpp', 'ipc/GestureEventListener.cpp', 'ipc/ImageBridgeChild.cpp', 'ipc/ImageBridgeParent.cpp', 'ipc/ISurfaceAllocator.cpp', 'ipc/LayerTransactionChild.cpp', 'ipc/LayerTransactionParent.cpp', 'ipc/ShadowLayerChild.cpp',
--- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -153,16 +153,19 @@ public: #endif // MOZ_DUMP_PAINTING virtual void NotifyLayersTransaction() MOZ_OVERRIDE; virtual void Pause() MOZ_OVERRIDE; virtual bool Resume() MOZ_OVERRIDE; virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; } + virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE { + return mWidgetSize; + } GLContext* gl() const { return mGLContext; } ShaderProgramType GetFBOLayerProgramType() const { return mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB ? RGBARectLayerProgramType : RGBALayerProgramType; } gfx::SurfaceFormat GetFBOFormat() const { return gfx::FORMAT_R8G8B8A8;
--- a/gfx/layers/opengl/GLManager.cpp +++ b/gfx/layers/opengl/GLManager.cpp @@ -1,24 +1,26 @@ /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * 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 "GLManager.h" #include "CompositorOGL.h" // for CompositorOGL #include "GLContext.h" // for GLContext +#include "Layers.h" // for LayerManager #include "mozilla/Assertions.h" // for MOZ_CRASH #include "mozilla/Attributes.h" // for MOZ_OVERRIDE #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/LayersTypes.h" #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr +#include "nsISupportsImpl.h" // for LayerManager::AddRef, etc using namespace mozilla::gl; namespace mozilla { namespace layers { class GLManagerCompositor : public GLManager { @@ -42,20 +44,27 @@ public: mImpl->BindAndDrawQuad(aProg); } private: RefPtr<CompositorOGL> mImpl; }; /* static */ GLManager* -GLManager::CreateGLManager(LayerManagerComposite* aManager) +GLManager::CreateGLManager(LayerManager* aManager) { - if (aManager && - Compositor::GetBackend() == LAYERS_OPENGL) { - return new GLManagerCompositor(static_cast<CompositorOGL*>( - aManager->GetCompositor())); + if (!aManager) { + return nullptr; } - return nullptr; + if (aManager->GetBackendType() == LAYERS_NONE) { + if (Compositor::GetBackend() == LAYERS_OPENGL) { + return new GLManagerCompositor(static_cast<CompositorOGL*>( + static_cast<LayerManagerComposite*>(aManager)->GetCompositor())); + } else { + return nullptr; + } + } + + MOZ_CRASH("Cannot create GLManager for non-GL layer manager"); } } }
--- a/gfx/layers/opengl/GLManager.h +++ b/gfx/layers/opengl/GLManager.h @@ -11,27 +11,27 @@ namespace mozilla { namespace gl { class GLContext; } namespace layers { -class LayerManagerComposite; +class LayerManager; /** * Minimal interface to allow widgets to draw using OpenGL. Abstracts * CompositorOGL. Call CreateGLManager with a LayerManagerComposite * backed by a CompositorOGL. */ class GLManager { public: - static GLManager* CreateGLManager(LayerManagerComposite* aManager); + static GLManager* CreateGLManager(LayerManager* aManager); virtual ~GLManager() {} virtual gl::GLContext* gl() const = 0; virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0; virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0; ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
--- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -642,18 +642,17 @@ RenderFrameParent::RenderFrameParent(nsF , mFrameLoaderDestroyed(false) , mBackgroundColor(gfxRGBA(1, 1, 1)) { *aId = 0; nsRefPtr<LayerManager> lm = GetFrom(mFrameLoader); // Perhaps the document containing this frame currently has no presentation? if (lm && lm->GetBackendType() == LAYERS_CLIENT) { - *aTextureFactoryIdentifier = - static_cast<ClientLayerManager*>(lm.get())->GetTextureFactoryIdentifier(); + *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); } else { *aTextureFactoryIdentifier = TextureFactoryIdentifier(); } if (lm && lm->GetRoot() && lm->GetRoot()->AsContainerLayer()) { ViewID rootScrollId = lm->GetRoot()->AsContainerLayer()->GetFrameMetrics().mScrollId; if (rootScrollId != FrameMetrics::NULL_SCROLL_ID) { mContentViews[rootScrollId] = new nsContentView(aFrameLoader, rootScrollId, true);
--- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -2323,17 +2323,17 @@ nsIMEUpdatePreference nsWindow::GetIMEUpdatePreference() { int8_t notifications = (nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE | nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE); return nsIMEUpdatePreference(notifications, true); } void -nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) +nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) { JNIEnv *env = GetJNIForThread(); NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowUnderlay()!"); if (!env) return; AutoLocalJNIFrame jniFrame(env); @@ -2357,17 +2357,17 @@ nsWindow::DrawWindowUnderlay(LayerManage client->ActivateProgram(); if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return; if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return; client->DeactivateProgram(); // redundant, but in case somebody adds code after this... } void -nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) +nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) { PROFILER_LABEL("nsWindow", "DrawWindowOverlay"); JNIEnv *env = GetJNIForThread(); NS_ABORT_IF_FALSE(env, "No JNI environment at DrawWindowOverlay()!"); if (!env) return; AutoLocalJNIFrame jniFrame(env); @@ -2425,17 +2425,21 @@ nsWindow::ForceIsFirstPaint() sCompositorParent->ForceIsFirstPaint(); } } float nsWindow::ComputeRenderIntegrity() { if (sCompositorParent) { - return sCompositorParent->ComputeRenderIntegrity(); + mozilla::layers::LayerManagerComposite* manager = + static_cast<mozilla::layers::LayerManagerComposite*>(sCompositorParent->GetLayerManager()); + if (manager) { + return manager->ComputeRenderIntegrity(); + } } return 1.f; } bool nsWindow::WidgetPaintsBackground() {
--- a/widget/android/nsWindow.h +++ b/widget/android/nsWindow.h @@ -148,18 +148,18 @@ public: LayerManager* GetLayerManager (PLayerTransactionChild* aShadowManager = nullptr, LayersBackend aBackendHint = mozilla::layers::LAYERS_NONE, LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); virtual bool NeedsPaint(); - virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect); - virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect); + virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect); + virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect); virtual mozilla::layers::CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE; static void SetCompositor(mozilla::layers::LayerManager* aLayerManager, mozilla::layers::CompositorParent* aCompositorParent, mozilla::layers::CompositorChild* aCompositorChild); static void ScheduleComposite(); static void ScheduleResumeComposition(int width, int height);
--- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -544,19 +544,19 @@ public: #ifdef ACCESSIBILITY already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible(); #endif virtual void CreateCompositor(); virtual gfxASurface* GetThebesSurface(); virtual void PrepareWindowEffects() MOZ_OVERRIDE; virtual void CleanupWindowEffects() MOZ_OVERRIDE; - virtual bool PreRender(LayerManagerComposite* aManager) MOZ_OVERRIDE; - virtual void PostRender(LayerManagerComposite* aManager) MOZ_OVERRIDE; - virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) MOZ_OVERRIDE; + virtual bool PreRender(LayerManager* aManager) MOZ_OVERRIDE; + virtual void PostRender(LayerManager* aManager) MOZ_OVERRIDE; + virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) MOZ_OVERRIDE; virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries); void HidePlugin(); void UpdatePluginPort(); void ResetParent();
--- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -58,16 +58,17 @@ #include "Layers.h" #include "ClientLayerManager.h" #include "mozilla/layers/LayerManagerComposite.h" #include "GLTextureImage.h" #include "GLContextProvider.h" #include "GLContext.h" #include "GLUploadHelpers.h" #include "mozilla/layers/GLManager.h" +#include "mozilla/layers/CompositorCocoaWidgetHelper.h" #include "mozilla/layers/CompositorOGL.h" #include "mozilla/layers/BasicCompositor.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/BorrowedContext.h" #ifdef ACCESSIBILITY #include "nsAccessibilityService.h" #include "mozilla/a11y/Platform.h" @@ -2041,17 +2042,17 @@ void nsChildView::CleanupWindowEffects() { mResizerImage = nullptr; mCornerMaskImage = nullptr; mTitlebarImage = nullptr; } bool -nsChildView::PreRender(LayerManagerComposite* aManager) +nsChildView::PreRender(LayerManager* aManager) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (!manager) { return true; } // The lock makes sure that we don't attempt to tear down the view while // compositing. That would make us unable to call postRender on it when the @@ -2063,29 +2064,29 @@ nsChildView::PreRender(LayerManagerCompo if (![(ChildView*)mView preRender:glContext]) { mViewTearDownLock.Unlock(); return false; } return true; } void -nsChildView::PostRender(LayerManagerComposite* aManager) +nsChildView::PostRender(LayerManager* aManager) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (!manager) { return; } NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext); [(ChildView*)mView postRender:glContext]; mViewTearDownLock.Unlock(); } void -nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) +nsChildView::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) { nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager)); if (manager) { DrawWindowOverlay(manager, aRect); } } void
--- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -36,17 +36,16 @@ class nsIntRegion; namespace mozilla { namespace dom { class TabChild; } namespace layers { class Composer2D; class CompositorChild; class LayerManager; -class LayerManagerComposite; class PLayerTransactionChild; } namespace gfx { class DrawTarget; } } /** @@ -92,18 +91,18 @@ typedef void* nsNativeWidget; #ifdef XP_WIN #define NS_NATIVE_TSF_THREAD_MGR 100 #define NS_NATIVE_TSF_CATEGORY_MGR 101 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102 #define NS_NATIVE_ICOREWINDOW 103 // winrt specific #endif #define NS_IWIDGET_IID \ -{ 0x746cb189, 0x9793, 0x4e53, \ - { 0x89, 0x47, 0x78, 0x56, 0xb6, 0xcd, 0x9f, 0x71 } } +{ 0xa1f684e6, 0x2ae1, 0x4513, \ + { 0xb6, 0x89, 0xf4, 0xd4, 0xfe, 0x9d, 0x2c, 0xdb } } /* * Window shadow styles * Also used for the -moz-window-shadow CSS property */ #define NS_STYLE_WINDOW_SHADOW_NONE 0 #define NS_STYLE_WINDOW_SHADOW_DEFAULT 1 @@ -460,17 +459,16 @@ enum NotificationToIME { class nsIWidget : public nsISupports { protected: typedef mozilla::dom::TabChild TabChild; public: typedef mozilla::layers::Composer2D Composer2D; typedef mozilla::layers::CompositorChild CompositorChild; typedef mozilla::layers::LayerManager LayerManager; - typedef mozilla::layers::LayerManagerComposite LayerManagerComposite; typedef mozilla::layers::LayersBackend LayersBackend; typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild; typedef mozilla::widget::NotificationToIME NotificationToIME; typedef mozilla::widget::IMEState IMEState; typedef mozilla::widget::InputContext InputContext; typedef mozilla::widget::InputContextAction InputContextAction; typedef mozilla::widget::SizeConstraints SizeConstraints; @@ -1213,46 +1211,48 @@ class nsIWidget : public nsISupports { * Called when shutting down the LayerManager to clean-up any cached resources. * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ virtual void CleanupWindowEffects() = 0; /** - * Called before rendering using OMTC. Returns false when the widget is + * Called before rendering using OpenGL. Returns false when the widget is * not ready to be rendered (for example while the window is closed). * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ - virtual bool PreRender(LayerManagerComposite* aManager) = 0; + virtual bool PreRender(LayerManager* aManager) = 0; /** - * Called after rendering using OMTC. Not called when rendering was + * Called after rendering using OpenGL. Not called when rendering was * cancelled by a negative return value from PreRender. * * Always called from the compositing thread, which may be the main-thread if * OMTC is not enabled. */ - virtual void PostRender(LayerManagerComposite* aManager) = 0; + virtual void PostRender(LayerManager* aManager) = 0; /** * Called before the LayerManager draws the layer tree. * - * Always called from the compositing thread. + * Always called from the compositing thread, which may be the main-thread if + * OMTC is not enabled. */ - virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0; + virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) = 0; /** * Called after the LayerManager draws the layer tree * - * Always called from the compositing thread. + * Always called from the compositing thread, which may be the main-thread if + * OMTC is not enabled. */ - virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) = 0; + virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) = 0; /** * Return a DrawTarget for the window which can be composited into. * * Called by BasicCompositor on the compositor thread for OMTC drawing * before each composition. */ virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() = 0;
--- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -131,20 +131,20 @@ public: LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight); virtual void CreateCompositor(); virtual void CreateCompositor(int aWidth, int aHeight); virtual void PrepareWindowEffects() {} virtual void CleanupWindowEffects() {} - virtual bool PreRender(LayerManagerComposite* aManager) { return true; } - virtual void PostRender(LayerManagerComposite* aManager) {} - virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) {} - virtual void DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) {} + virtual bool PreRender(LayerManager* aManager) { return true; } + virtual void PostRender(LayerManager* aManager) {} + virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {} + virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {} virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing(); virtual void EndRemoteDrawing() { }; virtual void CleanupRemoteDrawing() { }; virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {} virtual gfxASurface* GetThebesSurface(); NS_IMETHOD SetModal(bool aModal); NS_IMETHOD SetWindowClass(const nsAString& xulWinType); // Return whether this widget interprets parameters to Move and Resize APIs