Bug 939598. Always call BeginTransaction before EndTransaction. r=mattwoodrow

This commit is contained in:
Nicholas Cameron 2013-11-20 20:27:23 +13:00
parent cfd80862b1
commit 90ba9aaf83
3 changed files with 18 additions and 9 deletions

View File

@ -168,10 +168,11 @@ LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget)
bool
LayerManagerComposite::EndEmptyTransaction(EndTransactionFlags aFlags)
{
mInTransaction = false;
if (!mRoot)
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
if (!mRoot) {
mInTransaction = false;
return false;
}
EndTransaction(nullptr, nullptr);
return true;
@ -182,6 +183,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
void* aCallbackData,
EndTransactionFlags aFlags)
{
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
mInTransaction = false;
#ifdef MOZ_LAYERS_HAVE_LOG

View File

@ -500,6 +500,15 @@ CompositorParent::ScheduleComposition()
void
CompositorParent::Composite()
{
if (CanComposite()) {
mLayerManager->BeginTransaction();
}
CompositeInTransaction();
}
void
CompositorParent::CompositeInTransaction()
{
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
PROFILER_LABEL("CompositorParent", "Composite");
@ -564,7 +573,7 @@ CompositorParent::ComposeToTarget(DrawTarget* aTarget)
mLayerManager->BeginTransactionWithDrawTarget(aTarget);
// Since CanComposite() is true, Composite() must end the layers txn
// we opened above.
Composite();
CompositeInTransaction();
}
bool
@ -629,10 +638,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
}
}
ScheduleComposition();
LayerManagerComposite *layerComposite = mLayerManager->AsLayerManagerComposite();
if (layerComposite) {
layerComposite->NotifyShadowTreeTransaction();
}
mLayerManager->NotifyShadowTreeTransaction();
}
void

View File

@ -230,7 +230,8 @@ protected:
bool* aSuccess);
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers);
virtual void ScheduleTask(CancelableTask*, int);
virtual void Composite();
void Composite();
void CompositeInTransaction();
virtual void ComposeToTarget(gfx::DrawTarget* aTarget);
void SetEGLSurfaceSize(int width, int height);