Browse Source

Bug 1458270: Clean up in the shutdown observer. r=milan a=jcristau

--HG--
extra : amend_source : 7b1277a18a3ed4f441deef8b51cb4ec4dde614cc
pull/1/head
David Major 4 years ago committed by Roy Tam
parent
commit
2c709a3e82
  1. 18
      widget/GfxInfoBase.cpp
  2. 1
      widget/GfxInfoBase.h
  3. 8
      widget/GfxInfoX11.cpp
  4. 4
      widget/android/GfxInfo.cpp
  5. 4
      widget/cocoa/GfxInfo.mm
  6. 4
      widget/uikit/GfxInfo.cpp
  7. 4
      widget/windows/GfxInfo.cpp

18
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;
}
@ -855,6 +862,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);

1
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(); }

8
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!

4
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.

4
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) {

4
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.

4
widget/windows/GfxInfo.cpp

@ -1163,6 +1163,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;

Loading…
Cancel
Save