mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Invalidate layers when starting a transaction on a stale device. (bug 1245765 part 9, r=mattwoodrow)
--HG-- extra : rebase_source : 987513504b8470a501db313ab0905d20219949c0
This commit is contained in:
parent
e2f9524db9
commit
76e3b91746
@ -102,6 +102,7 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
, mNeedsComposite(false)
|
||||
, mPaintSequenceNumber(0)
|
||||
, mForwarder(new ShadowLayerForwarder)
|
||||
, mDeviceCounter(gfxPlatform::GetPlatform()->GetDeviceCounter())
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientLayerManager);
|
||||
mMemoryPressureObserver = new MemoryPressureObserver(this);
|
||||
@ -189,6 +190,10 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
NS_ASSERTION(!InTransaction(), "Nested transactions not allowed");
|
||||
mPhase = PHASE_CONSTRUCTION;
|
||||
|
||||
if (DependsOnStaleDevice()) {
|
||||
FrameLayerBuilder::InvalidateAllLayers(this);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mKeepAlive.IsEmpty(), "uncommitted txn?");
|
||||
|
||||
// If the last transaction was incomplete (a failed DoEmptyTransaction),
|
||||
@ -833,6 +838,12 @@ ClientLayerManager::RemoveDidCompositeObserver(DidCompositeObserver* aObserver)
|
||||
mDidCompositeObservers.RemoveElement(aObserver);
|
||||
}
|
||||
|
||||
bool
|
||||
ClientLayerManager::DependsOnStaleDevice() const
|
||||
{
|
||||
return gfxPlatform::GetPlatform()->GetDeviceCounter() != mDeviceCounter;
|
||||
}
|
||||
|
||||
ClientLayer::~ClientLayer()
|
||||
{
|
||||
if (HasShadow()) {
|
||||
|
@ -303,6 +303,8 @@ private:
|
||||
void* aCallbackData,
|
||||
EndTransactionFlags);
|
||||
|
||||
bool DependsOnStaleDevice() const;
|
||||
|
||||
LayerRefArray mKeepAlive;
|
||||
|
||||
nsIWidget* mWidget;
|
||||
@ -353,6 +355,7 @@ private:
|
||||
nsTArray<DidCompositeObserver*> mDidCompositeObservers;
|
||||
|
||||
RefPtr<MemoryPressureObserver> mMemoryPressureObserver;
|
||||
uint64_t mDeviceCounter;
|
||||
};
|
||||
|
||||
class ClientLayer : public ShadowableLayer
|
||||
|
@ -476,6 +476,7 @@ gfxPlatform::gfxPlatform()
|
||||
, mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo)
|
||||
, mCompositorBackend(layers::LayersBackend::LAYERS_NONE)
|
||||
, mScreenDepth(0)
|
||||
, mDeviceCounter(0)
|
||||
{
|
||||
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
|
||||
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
|
||||
@ -2363,3 +2364,9 @@ gfxPlatform::SupportsApzDragInput() const
|
||||
{
|
||||
return gfxPrefs::APZDragEnabled();
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::BumpDeviceCounter()
|
||||
{
|
||||
mDeviceCounter++;
|
||||
}
|
||||
|
@ -650,6 +650,10 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t GetDeviceCounter() const {
|
||||
return mDeviceCounter;
|
||||
}
|
||||
|
||||
protected:
|
||||
gfxPlatform();
|
||||
virtual ~gfxPlatform();
|
||||
@ -679,6 +683,11 @@ protected:
|
||||
*/
|
||||
void UpdateDeviceInitData();
|
||||
|
||||
/**
|
||||
* Increase the global device counter after a device has been removed/reset.
|
||||
*/
|
||||
void BumpDeviceCounter();
|
||||
|
||||
/**
|
||||
* Called when new device preferences are available.
|
||||
*/
|
||||
@ -791,6 +800,9 @@ private:
|
||||
|
||||
int32_t mScreenDepth;
|
||||
mozilla::gfx::IntSize mScreenSize;
|
||||
|
||||
// Generation number for devices that ClientLayerManagers might depend on.
|
||||
uint64_t mDeviceCounter;
|
||||
};
|
||||
|
||||
#endif /* GFX_PLATFORM_H */
|
||||
|
@ -493,6 +493,7 @@ gfxWindowsPlatform::HandleDeviceReset()
|
||||
// list of which devices to create.
|
||||
UpdateDeviceInitData();
|
||||
InitializeDevices();
|
||||
BumpDeviceCounter();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user