зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1522415: Properly track initialization state in case a device reset occurs during initialization. r=rhunt
This fixes a situation where a Device Reset occurs during initialization, after mDC has already been created but before mBitmap is created. In this case IsValid and EnsureInitialized would previously return 'true' in subsequent calls, since they were only checking for the DC. This patch makes us properly store the full result of initialization for checking with IsValid and re-runs of EnsureInitialized. Differential Revision: https://phabricator.services.mozilla.com/D17486 --HG-- extra : rebase_source : a20480486c094e14c3a2f67e5f39b1efbece5c69
This commit is contained in:
Родитель
fb424198ee
Коммит
d8a0c14970
|
@ -45,7 +45,7 @@ DrawTargetD2D1::DrawTargetD2D1()
|
|||
mTransformedGlyphsSinceLastPurge(0),
|
||||
mComplexBlendsWithListInList(0),
|
||||
mDeviceSeq(0),
|
||||
mIsInitialized(false) {}
|
||||
mInitState(InitState::Uninitialized) {}
|
||||
|
||||
DrawTargetD2D1::~DrawTargetD2D1() {
|
||||
PopAllClips();
|
||||
|
@ -90,7 +90,7 @@ DrawTargetD2D1::~DrawTargetD2D1() {
|
|||
bool DrawTargetD2D1::IsValid() const {
|
||||
if (NS_IsMainThread()) {
|
||||
// Uninitialized DTs are considered valid.
|
||||
return !mIsInitialized || mDC;
|
||||
return mInitState != InitState::Failure;
|
||||
} else {
|
||||
return const_cast<DrawTargetD2D1 *>(this)->EnsureInitialized();
|
||||
}
|
||||
|
@ -1315,12 +1315,12 @@ void DrawTargetD2D1::FlushInternal(bool aHasDependencyMutex /* = false */) {
|
|||
}
|
||||
|
||||
bool DrawTargetD2D1::EnsureInitialized() {
|
||||
if (mIsInitialized) {
|
||||
return !!mDC;
|
||||
if (mInitState != InitState::Uninitialized) {
|
||||
return mInitState == InitState::Success;
|
||||
}
|
||||
|
||||
// Don't retry.
|
||||
mIsInitialized = true;
|
||||
mInitState = InitState::Failure;
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1400,6 +1400,8 @@ bool DrawTargetD2D1::EnsureInitialized() {
|
|||
mDC->Clear();
|
||||
}
|
||||
|
||||
mInitState = InitState::Success;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,12 @@ class DrawTargetD2D1 : public DrawTarget {
|
|||
bool EnsureLuminanceEffect();
|
||||
RefPtr<ID2D1Effect> mLuminanceEffect;
|
||||
|
||||
bool mIsInitialized;
|
||||
enum class InitState {
|
||||
Uninitialized,
|
||||
Success,
|
||||
Failure
|
||||
};
|
||||
InitState mInitState;
|
||||
RefPtr<IDXGISurface> mSurface;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче