Bug 966679 - Resolve RefLayers during IPDL transactions. r=nical

This commit is contained in:
Matt Woodrow 2014-02-11 17:01:20 +13:00
parent ee8bfdcd6f
commit fb1c8410a8
5 changed files with 29 additions and 4 deletions

View File

@ -98,6 +98,9 @@ WalkTheTree(Layer* aLayer,
void
AsyncCompositionManager::ResolveRefLayers()
{
if (!mLayerManager->GetRoot()) {
return;
}
WalkTheTree<Resolve>(mLayerManager->GetRoot(),
mReadyForCompose,
mTargetConfig);
@ -106,6 +109,9 @@ AsyncCompositionManager::ResolveRefLayers()
void
AsyncCompositionManager::DetachRefLayers()
{
if (!mLayerManager->GetRoot()) {
return;
}
WalkTheTree<Detach>(mLayerManager->GetRoot(),
mReadyForCompose,
mTargetConfig);

View File

@ -201,10 +201,18 @@ private:
class MOZ_STACK_CLASS AutoResolveRefLayers {
public:
AutoResolveRefLayers(AsyncCompositionManager* aManager) : mManager(aManager)
{ mManager->ResolveRefLayers(); }
{
if (mManager) {
mManager->ResolveRefLayers();
}
}
~AutoResolveRefLayers()
{ mManager->DetachRefLayers(); }
{
if (mManager) {
mManager->DetachRefLayers();
}
}
private:
AsyncCompositionManager* mManager;

View File

@ -100,6 +100,7 @@ public:
const TargetConfig& aTargetConfig,
bool aIsFirstPaint,
bool aScheduleComposite) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager() MOZ_OVERRIDE { return mCompositionManager; }
/**
* This forces the is-first-paint flag to true. This is intended to
* be called by the widget code when it loses its viewport information

View File

@ -40,6 +40,7 @@
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#include "GeckoProfiler.h"
#include "mozilla/layers/TextureHost.h"
#include "mozilla/layers/AsyncCompositionManager.h"
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
@ -205,7 +206,10 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
EditReplyVector replyv;
layer_manager()->BeginTransactionWithDrawTarget(nullptr);
{
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager());
layer_manager()->BeginTransaction();
}
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
const Edit& edit = cset[i];
@ -439,7 +443,10 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
}
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
{
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager());
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
}
if (reply) {
reply->SetCapacity(replyv.size());

View File

@ -12,6 +12,7 @@ namespace layers {
class TargetConfig;
class LayerTransactionParent;
class AsyncCompositionManager;
class ShadowLayersManager
{
@ -20,6 +21,8 @@ public:
const TargetConfig& aTargetConfig,
bool aIsFirstPaint,
bool aScheduleComposite) = 0;
virtual AsyncCompositionManager* GetCompositionManager() { return nullptr; }
};
} // layers