diff options
author | David Major <dmajor@mozilla.com> | 2018-05-23 11:54:21 -0700 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-07 06:08:05 +0200 |
commit | 6b36aa089d31573cf9a72da530dc423b3978fda3 (patch) | |
tree | 1e4c3891c5f61f6eed4425d110601a89f5c9a09f | |
parent | 63d30436895af897f71c40669ca587b495d98649 (diff) | |
download | UXP-6b36aa089d31573cf9a72da530dc423b3978fda3.tar UXP-6b36aa089d31573cf9a72da530dc423b3978fda3.tar.gz UXP-6b36aa089d31573cf9a72da530dc423b3978fda3.tar.lz UXP-6b36aa089d31573cf9a72da530dc423b3978fda3.tar.xz UXP-6b36aa089d31573cf9a72da530dc423b3978fda3.zip |
Bug 1458270: Clean up in the shutdown observer. r=milan a=jcristau
--HG--
extra : amend_source : 7b1277a18a3ed4f441deef8b51cb4ec4dde614cc
-rw-r--r-- | widget/GfxInfoBase.cpp | 18 | ||||
-rw-r--r-- | widget/GfxInfoBase.h | 1 | ||||
-rw-r--r-- | widget/GfxInfoX11.cpp | 8 | ||||
-rw-r--r-- | widget/android/GfxInfo.cpp | 4 | ||||
-rw-r--r-- | widget/cocoa/GfxInfo.mm | 4 | ||||
-rw-r--r-- | widget/uikit/GfxInfo.cpp | 4 | ||||
-rw-r--r-- | widget/windows/GfxInfo.cpp | 4 |
7 files changed, 39 insertions, 4 deletions
diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index c937f5099..e20de8277 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -43,6 +43,7 @@ using mozilla::MutexAutoLock; nsTArray<GfxDriverInfo>* GfxInfoBase::mDriverInfo; bool GfxInfoBase::mDriverInfoObserverInitialized; +bool GfxInfoBase::mShutdownOccurred; // Observes for shutdown so that the child GfxDriverInfo list is freed. class ShutdownObserver : public nsIObserver @@ -62,11 +63,17 @@ public: delete GfxInfoBase::mDriverInfo; GfxInfoBase::mDriverInfo = nullptr; - for (uint32_t i = 0; i < DeviceFamilyMax; i++) + for (uint32_t i = 0; i < DeviceFamilyMax; i++) { delete GfxDriverInfo::mDeviceFamilies[i]; + GfxDriverInfo::mDeviceFamilies[i] = nullptr; + } - for (uint32_t i = 0; i < DeviceVendorMax; i++) + for (uint32_t i = 0; i < DeviceVendorMax; i++) { delete GfxDriverInfo::mDeviceVendors[i]; + GfxDriverInfo::mDeviceVendors[i] = nullptr; + } + + GfxInfoBase::mShutdownOccurred = true; return NS_OK; } @@ -849,6 +856,13 @@ GfxInfoBase::GetFeatureStatusImpl(int32_t aFeature, return NS_OK; } + if (mShutdownOccurred) { + // This is futile; we've already commenced shutdown and our blocklists have + // been deleted. We may want to look into resurrecting the blocklist instead + // but for now, just don't even go there. + return NS_OK; + } + // If an operating system was provided by the derived GetFeatureStatusImpl, // grab it here. Otherwise, the OS is unknown. OperatingSystem os = (aOS ? *aOS : OperatingSystem::Unknown); diff --git a/widget/GfxInfoBase.h b/widget/GfxInfoBase.h index 6d30f1b71..5bc23f762 100644 --- a/widget/GfxInfoBase.h +++ b/widget/GfxInfoBase.h @@ -77,6 +77,7 @@ public: static nsTArray<GfxDriverInfo>* mDriverInfo; static bool mDriverInfoObserverInitialized; + static bool mShutdownOccurred; virtual nsString Model() { return EmptyString(); } virtual nsString Hardware() { return EmptyString(); } diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 48fc3dbb5..338dcac67 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -268,8 +268,6 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, OperatingSystem* aOS /* = nullptr */) { - GetData(); - NS_ENSURE_ARG_POINTER(aStatus); *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; aSuggestedDriverVersion.SetIsVoid(true); @@ -277,6 +275,12 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + + GetData(); + if (mGLMajorVersion == 1) { // We're on OpenGL 1. In most cases that indicates really old hardware. // We better block them, rather than rely on them to fail gracefully, because they don't! diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp index 181629e96..d92cdb526 100644 --- a/widget/android/GfxInfo.cpp +++ b/widget/android/GfxInfo.cpp @@ -377,6 +377,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // OpenGL layers are never blacklisted on Android. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm index 74333c514..85c469286 100644 --- a/widget/cocoa/GfxInfo.mm +++ b/widget/cocoa/GfxInfo.mm @@ -308,6 +308,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // Don't evaluate special cases when we're evaluating the downloaded blocklist. if (!aDriverInfo.Length()) { if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) { diff --git a/widget/uikit/GfxInfo.cpp b/widget/uikit/GfxInfo.cpp index 2aea3b5ea..cabe993dd 100644 --- a/widget/uikit/GfxInfo.cpp +++ b/widget/uikit/GfxInfo.cpp @@ -175,6 +175,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = OperatingSystem::Ios; + if (mShutdownOccurred) { + return NS_OK; + } + // OpenGL layers are never blacklisted on iOS. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 8a429ad32..c62f5873e 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -1101,6 +1101,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, if (aOS) *aOS = os; + if (mShutdownOccurred) { + return NS_OK; + } + // Don't evaluate special cases if we're checking the downloaded blocklist. if (!aDriverInfo.Length()) { nsAutoString adapterVendorID; |