mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-13 15:34:01 +00:00
Bug 781679 - Assert that we're not in the middle of a transaction when we switch layer managers. r=mattwoodrow
This commit is contained in:
parent
f034089eec
commit
022bcccbfb
@ -139,7 +139,11 @@ class THEBES_API LayerManager {
|
||||
NS_INLINE_DECL_REFCOUNTING(LayerManager)
|
||||
|
||||
public:
|
||||
LayerManager() : mDestroyed(false), mSnapEffectiveTransforms(true), mId(0)
|
||||
LayerManager()
|
||||
: mDestroyed(false)
|
||||
, mSnapEffectiveTransforms(true)
|
||||
, mId(0)
|
||||
, mInTransaction(false)
|
||||
{
|
||||
InitLog();
|
||||
}
|
||||
@ -455,6 +459,8 @@ public:
|
||||
|
||||
virtual bool IsCompositingCheap() { return true; }
|
||||
|
||||
bool IsInTransaction() const { return mInTransaction; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<Layer> mRoot;
|
||||
gfx::UserData mUserData;
|
||||
@ -468,6 +474,7 @@ protected:
|
||||
static void InitLog();
|
||||
static PRLogModuleInfo* sLog;
|
||||
uint64_t mId;
|
||||
bool mInTransaction;
|
||||
private:
|
||||
TimeStamp mLastFrameTime;
|
||||
nsTArray<float> mFrameTimes;
|
||||
|
@ -152,6 +152,7 @@ BasicLayerManager::SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, Sc
|
||||
void
|
||||
BasicLayerManager::BeginTransaction()
|
||||
{
|
||||
mInTransaction = true;
|
||||
mUsingDefaultTarget = true;
|
||||
BeginTransactionWithTarget(mDefaultTarget);
|
||||
}
|
||||
@ -204,6 +205,8 @@ BasicLayerManager::PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxCon
|
||||
void
|
||||
BasicLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
{
|
||||
mInTransaction = true;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
MOZ_LAYERS_LOG(("[----- BeginTransaction"));
|
||||
Log();
|
||||
@ -390,6 +393,8 @@ BasicLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
EndTransactionInternal(aCallback, aCallbackData, aFlags);
|
||||
}
|
||||
|
||||
@ -401,6 +406,7 @@ BasicLayerManager::AbortTransaction()
|
||||
mPhase = PHASE_NONE;
|
||||
#endif
|
||||
mUsingDefaultTarget = false;
|
||||
mInTransaction = false;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -529,6 +535,8 @@ BasicLayerManager::FlashWidgetUpdateArea(gfxContext *aContext)
|
||||
bool
|
||||
BasicLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
if (!mRoot) {
|
||||
return false;
|
||||
}
|
||||
|
@ -322,6 +322,8 @@ LayerManagerD3D10::SetRoot(Layer *aRoot)
|
||||
void
|
||||
LayerManagerD3D10::BeginTransaction()
|
||||
{
|
||||
mInTransaction = true;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
MOZ_LAYERS_LOG(("[----- BeginTransaction"));
|
||||
Log();
|
||||
@ -331,12 +333,15 @@ LayerManagerD3D10::BeginTransaction()
|
||||
void
|
||||
LayerManagerD3D10::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
{
|
||||
mInTransaction = true;
|
||||
mTarget = aTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
LayerManagerD3D10::EndEmptyTransaction(EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
if (!mRoot)
|
||||
return false;
|
||||
|
||||
@ -349,6 +354,8 @@ LayerManagerD3D10::EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
|
||||
mCurrentCallbackInfo.Callback = aCallback;
|
||||
mCurrentCallbackInfo.CallbackData = aCallbackData;
|
||||
|
@ -107,11 +107,13 @@ LayerManagerD3D9::Destroy()
|
||||
void
|
||||
LayerManagerD3D9::BeginTransaction()
|
||||
{
|
||||
mInTransaction = true;
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerD3D9::BeginTransactionWithTarget(gfxContext *aTarget)
|
||||
{
|
||||
mInTransaction = true;
|
||||
mTarget = aTarget;
|
||||
}
|
||||
|
||||
@ -123,6 +125,8 @@ LayerManagerD3D9::EndConstruction()
|
||||
bool
|
||||
LayerManagerD3D9::EndEmptyTransaction(EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
// If the device reset count from our last EndTransaction doesn't match
|
||||
// the current device reset count, the device must have been reset one or
|
||||
// more times since our last transaction. In that case, an empty transaction
|
||||
@ -139,6 +143,8 @@ LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
mDeviceResetCount = mDeviceManager->GetDeviceResetCount();
|
||||
|
||||
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
|
||||
|
@ -361,11 +361,14 @@ LayerManagerOGL::SetClippingRegion(const nsIntRegion& aClippingRegion)
|
||||
void
|
||||
LayerManagerOGL::BeginTransaction()
|
||||
{
|
||||
mInTransaction = true;
|
||||
}
|
||||
|
||||
void
|
||||
LayerManagerOGL::BeginTransactionWithTarget(gfxContext *aTarget)
|
||||
{
|
||||
mInTransaction = true;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
MOZ_LAYERS_LOG(("[----- BeginTransaction"));
|
||||
Log();
|
||||
@ -382,6 +385,8 @@ LayerManagerOGL::BeginTransactionWithTarget(gfxContext *aTarget)
|
||||
bool
|
||||
LayerManagerOGL::EndEmptyTransaction(EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
if (!mRoot)
|
||||
return false;
|
||||
|
||||
@ -394,6 +399,8 @@ LayerManagerOGL::EndTransaction(DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags aFlags)
|
||||
{
|
||||
mInTransaction = false;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
MOZ_LAYERS_LOG((" ----- (beginning paint)"));
|
||||
Log();
|
||||
|
@ -3153,6 +3153,8 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
|
||||
if (layerManagerD3D10->device() !=
|
||||
gfxWindowsPlatform::GetPlatform()->GetD3D10Device())
|
||||
{
|
||||
MOZ_ASSERT(!mLayerManager->IsInTransaction());
|
||||
|
||||
mLayerManager->Destroy();
|
||||
mLayerManager = nullptr;
|
||||
}
|
||||
@ -3184,6 +3186,8 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
|
||||
|
||||
if (mUseAcceleratedRendering) {
|
||||
if (aPersistence == LAYER_MANAGER_PERSISTENT && !sAllowD3D9) {
|
||||
MOZ_ASSERT(!mLayerManager || !mLayerManager->IsInTransaction());
|
||||
|
||||
// This will clear out our existing layer manager if we have one since
|
||||
// if we hit this with a LayerManager we're always using BasicLayers.
|
||||
nsToolkit::StartAllowingD3D9();
|
||||
|
Loading…
x
Reference in New Issue
Block a user