Bug 1137944 - Move plugin window metrics updates to a point during comososition where we know the remote layer tree is hooked up to the chrome layer tree. r=matt.woodrow

This commit is contained in:
Jim Mathies 2015-10-06 14:23:24 -05:00
parent 38a7f7db28
commit 1052af354d
2 changed files with 49 additions and 21 deletions

View File

@ -68,9 +68,11 @@ template<Op OP>
static void
WalkTheTree(Layer* aLayer,
bool& aReady,
bool &aHasRemote,
const TargetConfig& aTargetConfig,
bool aResolvePlugins)
CompositorParent* aCompositor,
bool& aHasRemote,
bool aWillResolvePlugins,
bool& aDidResolvePlugins)
{
if (RefLayer* ref = aLayer->AsRefLayer()) {
aHasRemote = true;
@ -88,20 +90,25 @@ WalkTheTree(Layer* aLayer,
if (OP == Resolve) {
ref->ConnectReferentLayer(referent);
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
if (aResolvePlugins) {
CompositorParent::UpdatePluginWindowState(ref->GetReferentId());
if (aCompositor && aWillResolvePlugins) {
aDidResolvePlugins |=
aCompositor->UpdatePluginWindowState(ref->GetReferentId());
}
#endif
} else {
ref->DetachReferentLayer(referent);
WalkTheTree<OP>(referent, aReady, aHasRemote, aTargetConfig, aResolvePlugins);
WalkTheTree<OP>(referent, aReady, aTargetConfig,
aCompositor, aHasRemote, aWillResolvePlugins,
aDidResolvePlugins);
}
}
}
}
for (Layer* child = aLayer->GetFirstChild();
child; child = child->GetNextSibling()) {
WalkTheTree<OP>(child, aReady, aHasRemote, aTargetConfig, aResolvePlugins);
WalkTheTree<OP>(child, aReady, aTargetConfig,
aCompositor, aHasRemote, aWillResolvePlugins,
aDidResolvePlugins);
}
}
@ -111,7 +118,6 @@ AsyncCompositionManager::AsyncCompositionManager(LayerManagerComposite* aManager
, mLayersUpdated(false)
, mPaintSyncId(0)
, mReadyForCompose(true)
, mHasRemoteContent(false)
{
}
@ -120,19 +126,35 @@ AsyncCompositionManager::~AsyncCompositionManager()
}
void
AsyncCompositionManager::ResolveRefLayers(bool aResolvePlugins)
AsyncCompositionManager::ResolveRefLayers(CompositorParent* aCompositor,
bool* aHasRemoteContent,
bool* aResolvePlugins)
{
if (aHasRemoteContent) {
*aHasRemoteContent = false;
}
if (!mLayerManager->GetRoot()) {
return;
}
mReadyForCompose = true;
mHasRemoteContent = false;
bool hasRemoteContent = false;
bool willResolvePlugins = (aResolvePlugins && *aResolvePlugins);
bool didResolvePlugins = false;
WalkTheTree<Resolve>(mLayerManager->GetRoot(),
mReadyForCompose,
mHasRemoteContent,
mTargetConfig,
aResolvePlugins);
aCompositor,
hasRemoteContent,
willResolvePlugins,
didResolvePlugins);
if (aHasRemoteContent) {
*aHasRemoteContent = hasRemoteContent;
}
if (aResolvePlugins) {
*aResolvePlugins = didResolvePlugins;
}
}
void
@ -141,12 +163,13 @@ AsyncCompositionManager::DetachRefLayers()
if (!mLayerManager->GetRoot()) {
return;
}
CompositorParent* dummy = nullptr;
bool ignored = false;
WalkTheTree<Detach>(mLayerManager->GetRoot(),
mReadyForCompose,
ignored,
mTargetConfig,
ignored);
dummy,
ignored, ignored, ignored);
}
void

View File

@ -26,6 +26,7 @@ class AsyncPanZoomController;
class Layer;
class LayerManagerComposite;
class AutoResolveRefLayers;
class CompositorParent;
// Represents (affine) transforms that are calculated from a content view.
struct ViewTransform {
@ -117,10 +118,6 @@ public:
// True if the underlying layer tree is ready to be composited.
bool ReadyForCompose() { return mReadyForCompose; }
// Indicates if during the last composition remote content was detected.
// Updated in CompositorParent's CompositeToTarget.
bool HasRemoteContent() { return mHasRemoteContent; }
// Returns true if the next composition will be the first for a
// particular document.
bool IsFirstPaint() { return mIsFirstPaint; }
@ -189,8 +186,15 @@ private:
*
* For reach RefLayer in our layer tree, look up its referent and connect it
* to the layer tree, if found.
* aHasRemoteContent - indicates if the layer tree contains a remote reflayer.
* May be null.
* aResolvePlugins - incoming value indicates if plugin windows should be
* updated through a call on aCompositor's UpdatePluginWindowState. Applies
* to linux and windows only, may be null. On return value indicates
* if any updates occured.
*/
void ResolveRefLayers(bool aResolvePlugins);
void ResolveRefLayers(CompositorParent* aCompositor, bool* aHasRemoteContent,
bool* aResolvePlugins);
/**
* Detaches all referents resolved by ResolveRefLayers.
@ -220,7 +224,6 @@ private:
int32_t mPaintSyncId;
bool mReadyForCompose;
bool mHasRemoteContent;
gfx::Matrix mWorldTransform;
LayerTransformRecorder mLayerTransformRecorder;
@ -231,11 +234,13 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AsyncCompositionManager::TransformsToSkip)
class MOZ_STACK_CLASS AutoResolveRefLayers {
public:
explicit AutoResolveRefLayers(AsyncCompositionManager* aManager,
bool aResolvePlugins = false) :
CompositorParent* aCompositor = nullptr,
bool* aHasRemoteContent = nullptr,
bool* aResolvePlugins = nullptr) :
mManager(aManager)
{
if (mManager) {
mManager->ResolveRefLayers(aResolvePlugins);
mManager->ResolveRefLayers(aCompositor, aHasRemoteContent, aResolvePlugins);
}
}