Bug 1127727 - Swap callbacks in the Compositor when dragging tabs between windows. r=billm

When remote browsing, swap the MozLayersReady callback in the compositor
when dragging tabs between windows.
This commit is contained in:
David Parks 2015-04-13 17:06:03 -07:00
parent d444fdc20b
commit 3d76a3308b
5 changed files with 34 additions and 0 deletions

View File

@ -973,6 +973,8 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
return rv;
}
mRemoteBrowser->SwapLayerTreeObservers(aOther->mRemoteBrowser);
nsCOMPtr<nsIBrowserDOMWindow> otherBrowserDOMWindow =
aOther->mRemoteBrowser->GetBrowserDOMWindow();
nsCOMPtr<nsIBrowserDOMWindow> browserDOMWindow =

View File

@ -2906,6 +2906,23 @@ TabParent::LayerTreeUpdate(bool aActive)
return true;
}
void
TabParent::SwapLayerTreeObservers(TabParent* aOther)
{
if (IsDestroyed() || aOther->IsDestroyed()) {
return;
}
RenderFrameParent* rfp = GetRenderFrame();
RenderFrameParent* otherRfp = aOther->GetRenderFrame();
if(!rfp || !otherRfp) {
return;
}
CompositorParent::SwapLayerTreeObservers(rfp->GetLayersId(),
otherRfp->GetLayersId());
}
bool
TabParent::RecvRemotePaintIsReady()
{

View File

@ -399,6 +399,7 @@ public:
bool RequestNotifyLayerTreeReady();
bool RequestNotifyLayerTreeCleared();
bool LayerTreeUpdate(bool aActive);
void SwapLayerTreeObservers(TabParent* aOther);
virtual bool
RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,

View File

@ -1443,6 +1443,19 @@ CompositorParent::DeallocateLayerTreeId(uint64_t aId)
NewRunnableFunction(&EraseLayerState, aId));
}
/* static */ void
CompositorParent::SwapLayerTreeObservers(uint64_t aLayerId, uint64_t aOtherLayerId)
{
EnsureLayerTreeMapReady();
MonitorAutoLock lock(*sIndirectLayerTreesLock);
NS_ASSERTION(sIndirectLayerTrees.find(aLayerId) != sIndirectLayerTrees.end(),
"SwapLayerTrees missing layer 1");
NS_ASSERTION(sIndirectLayerTrees.find(aOtherLayerId) != sIndirectLayerTrees.end(),
"SwapLayerTrees missing layer 2");
std::swap(sIndirectLayerTrees[aLayerId].mLayerTreeReadyObserver,
sIndirectLayerTrees[aOtherLayerId].mLayerTreeReadyObserver);
}
static void
UpdateControllerForLayersId(uint64_t aLayersId,
GeckoContentController* aController)

View File

@ -340,6 +340,7 @@ public:
static void RequestNotifyLayerTreeReady(uint64_t aLayersId, CompositorUpdateObserver* aObserver);
static void RequestNotifyLayerTreeCleared(uint64_t aLayersId, CompositorUpdateObserver* aObserver);
static void SwapLayerTreeObservers(uint64_t aLayer, uint64_t aOtherLayer);
float ComputeRenderIntegrity();