From 6bfc2aa91f43918d1fd8b7fe9321141deaf328e8 Mon Sep 17 00:00:00 2001 From: sotaro Date: Tue, 3 Jul 2018 08:43:17 +0900 Subject: [PATCH] Bug 1472600 - Update SyncHandle when Tab is moved between windows r=nical --- gfx/layers/ipc/CompositorBridgeParent.cpp | 3 ++- gfx/layers/ipc/PWebRenderBridge.ipdl | 3 ++- gfx/layers/wr/WebRenderBridgeChild.cpp | 4 +++- gfx/layers/wr/WebRenderBridgeChild.h | 3 ++- gfx/layers/wr/WebRenderBridgeParent.cpp | 5 +++-- gfx/layers/wr/WebRenderBridgeParent.h | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 365c71035652..1b267a502ed2 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -1802,7 +1802,8 @@ CompositorBridgeParent::RecvAdoptChild(const LayersId& child) childWrBridge->UpdateWebRender(mWrBridge->CompositorScheduler(), api, mWrBridge->AsyncImageManager(), - GetAnimationStorage()); + GetAnimationStorage(), + mWrBridge->GetTextureFactoryIdentifier()); // Pretend we composited, since parent CompositorBridgeParent was replaced. if (cpcp) { TimeStamp now = TimeStamp::Now(); diff --git a/gfx/layers/ipc/PWebRenderBridge.ipdl b/gfx/layers/ipc/PWebRenderBridge.ipdl index be1eaa917a26..d7168e4feb5f 100644 --- a/gfx/layers/ipc/PWebRenderBridge.ipdl +++ b/gfx/layers/ipc/PWebRenderBridge.ipdl @@ -17,6 +17,7 @@ include protocol PTexture; using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h"; using mozilla::layers::ScrollUpdatesMap from "FrameMetrics.h"; using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h"; +using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h"; using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h"; @@ -79,7 +80,7 @@ parent: async Shutdown(); sync ShutdownSync(); child: - async WrUpdated(IdNamespace aNewIdNamespace); + async WrUpdated(IdNamespace aNewIdNamespace, TextureFactoryIdentifier textureFactoryIdentifier); async __delete__(); }; diff --git a/gfx/layers/wr/WebRenderBridgeChild.cpp b/gfx/layers/wr/WebRenderBridgeChild.cpp index 7457053e9f1b..73e85bd82580 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.cpp +++ b/gfx/layers/wr/WebRenderBridgeChild.cpp @@ -542,11 +542,13 @@ WebRenderBridgeChild::InForwarderThread() } mozilla::ipc::IPCResult -WebRenderBridgeChild::RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace) +WebRenderBridgeChild::RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace, + const TextureFactoryIdentifier& textureFactoryIdentifier) { if (mManager) { mManager->WrUpdated(); } + IdentifyTextureHost(textureFactoryIdentifier); // Update mIdNamespace to identify obsolete keys and messages by WebRenderBridgeParent. // Since usage of invalid keys could cause crash in webrender. mIdNamespace = aNewIdNamespace; diff --git a/gfx/layers/wr/WebRenderBridgeChild.h b/gfx/layers/wr/WebRenderBridgeChild.h index 074ee6c2f3bf..eeabdacb3c55 100644 --- a/gfx/layers/wr/WebRenderBridgeChild.h +++ b/gfx/layers/wr/WebRenderBridgeChild.h @@ -200,7 +200,8 @@ private: void DoDestroy(); - mozilla::ipc::IPCResult RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace) override; + mozilla::ipc::IPCResult RecvWrUpdated(const wr::IdNamespace& aNewIdNamespace, + const TextureFactoryIdentifier& textureFactoryIdentifier) override; void AddIPDLReference() { MOZ_ASSERT(mIPCOpen == false); diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 45ca48d138fe..bb66f7b3cbd2 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -1121,7 +1121,8 @@ void WebRenderBridgeParent::UpdateWebRender(CompositorVsyncScheduler* aScheduler, wr::WebRenderAPI* aApi, AsyncImagePipelineManager* aImageMgr, - CompositorAnimationStorage* aAnimStorage) + CompositorAnimationStorage* aAnimStorage, + const TextureFactoryIdentifier& aTextureFactoryIdentifier) { MOZ_ASSERT(!mWidget); MOZ_ASSERT(aScheduler); @@ -1144,7 +1145,7 @@ WebRenderBridgeParent::UpdateWebRender(CompositorVsyncScheduler* aScheduler, // after new layers/webrender keys allocation. // Without client side's layout refactoring, we could not finish all old layers/webrender keys removals // before new layer/webrender keys allocation. In future, we could address the problem. - Unused << SendWrUpdated(mIdNamespace); + Unused << SendWrUpdated(mIdNamespace, aTextureFactoryIdentifier); CompositorBridgeParentBase* cBridge = mCompositorBridge; // XXX Stop to clear resources if webreder supports resources sharing between different webrender instances. ClearResources(); diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 0eca448fa9ac..180e9c273b8c 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -184,7 +184,8 @@ public: void UpdateWebRender(CompositorVsyncScheduler* aScheduler, wr::WebRenderAPI* aApi, AsyncImagePipelineManager* aImageMgr, - CompositorAnimationStorage* aAnimStorage); + CompositorAnimationStorage* aAnimStorage, + const TextureFactoryIdentifier& aTextureFactoryIdentifier); void RemoveEpochDataPriorTo(const wr::Epoch& aRenderedEpoch);