Remove gfxCrashReporterUtils.

Tag #20.
This commit is contained in:
wolfbeast 2018-05-20 12:10:50 +02:00 committed by Roy Tam
commit 121456f05a
19 changed files with 0 additions and 254 deletions

View file

@ -9,7 +9,6 @@
#include "AccessCheck.h"
#include "gfxContext.h"
#include "gfxCrashReporterUtils.h"
#include "gfxPattern.h"
#include "gfxPrefs.h"
#include "gfxUtils.h"
@ -956,7 +955,6 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
// Alright, now let's start trying.
bool forceEnabled = gfxPrefs::WebGLForceEnabled();
ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
MOZ_ASSERT(!gl);
std::vector<FailureReason> failReasons;
@ -1087,8 +1085,6 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
//////
reporter.SetSuccessful();
failureId = NS_LITERAL_CSTRING("SUCCESS");
return NS_OK;
}

View file

@ -12,7 +12,6 @@
#include "nsXPCOMStrings.h"
#include "nsISeekableStream.h"
#include "nsIGfxInfo.h"
#include "gfxCrashReporterUtils.h"
#include "prmem.h"
#include "prlink.h"
#include "AndroidMediaResourceServer.h"

View file

@ -21,7 +21,6 @@
#include "MFTDecoder.h"
#include "DriverCrashGuard.h"
#include "nsPrintfCString.h"
#include "gfxCrashReporterUtils.h"
#include "VideoUtils.h"
const CLSID CLSID_VideoProcessorMFT =
@ -271,8 +270,6 @@ D3D9DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
{
MOZ_ASSERT(NS_IsMainThread());
ScopedGfxFeatureReporter reporter("DXVA2D3D9");
gfx::D3D9VideoCrashGuard crashGuard;
if (crashGuard.Crashed()) {
NS_WARNING("DXVA2D3D9 crash detected");
@ -448,8 +445,6 @@ D3D9DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
Telemetry::Accumulate(Telemetry::MEDIA_DECODER_BACKEND_USED,
uint32_t(media::MediaDecoderBackend::WMFDXVA2D3D9));
reporter.SetSuccessful();
return S_OK;
}
@ -645,8 +640,6 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
{
HRESULT hr;
ScopedGfxFeatureReporter reporter("DXVA2D3D11");
gfx::D3D11VideoCrashGuard crashGuard;
if (crashGuard.Crashed()) {
NS_WARNING("DXVA2D3D11 crash detected");
@ -785,8 +778,6 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
Telemetry::Accumulate(Telemetry::MEDIA_DECODER_BACKEND_USED,
uint32_t(media::MediaDecoderBackend::WMFDXVA2D3D11));
reporter.SetSuccessful();
return S_OK;
}

View file

@ -19,7 +19,6 @@
#include "GLReadTexImageHelper.h"
#include "GLScreenBuffer.h"
#include "gfxCrashReporterUtils.h"
#include "gfxEnv.h"
#include "gfxUtils.h"
#include "GLContextProvider.h"
@ -523,8 +522,6 @@ GLContext::InitWithPrefix(const char* prefix, bool trygl)
MOZ_RELEASE_ASSERT(!mSymbols.fBindFramebuffer,
"GFX: InitWithPrefix should only be called once.");
ScopedGfxFeatureReporter reporter("GL Context");
if (!InitWithPrefixImpl(prefix, trygl)) {
// If initialization fails, zero the symbols to avoid hard-to-understand bugs.
mSymbols.Zero();
@ -532,7 +529,6 @@ GLContext::InitWithPrefix(const char* prefix, bool trygl)
return false;
}
reporter.SetSuccessful();
return true;
}

View file

@ -79,7 +79,6 @@
#endif
#include "gfxASurface.h"
#include "gfxCrashReporterUtils.h"
#include "gfxFailure.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"

View file

@ -35,8 +35,6 @@
#include "GLScreenBuffer.h"
#include "gfxPrefs.h"
#include "gfxCrashReporterUtils.h"
#ifdef MOZ_WIDGET_GTK
#include "gfxPlatformGtk.h"
#endif
@ -93,13 +91,11 @@ GLXLibrary::EnsureInitialized()
libGLfilename = "libGL.so.1";
#endif
ScopedGfxFeatureReporter reporter(libGLfilename, forceFeatureReport);
mOGLLibrary = PR_LoadLibrary(libGLfilename);
if (!mOGLLibrary) {
NS_WARNING("Couldn't load OpenGL shared library.");
return false;
}
reporter.SetSuccessful();
}
if (gfxEnv::GlxDebug()) {

View file

@ -11,8 +11,6 @@
#include "gfxPlatform.h"
#include "gfxWindowsSurface.h"
#include "gfxCrashReporterUtils.h"
#include "prenv.h"
#include "mozilla/Preferences.h"
@ -99,8 +97,6 @@ WGLLibrary::EnsureInitialized()
if (mInitialized)
return true;
mozilla::ScopedGfxFeatureReporter reporter("WGL");
std::string libGLFilename = "Opengl32.dll";
// SU_SPIES_DIRECTORY is for AMD CodeXL/gDEBugger
if (PR_GetEnv("SU_SPIES_DIRECTORY")) {
@ -268,7 +264,6 @@ WGLLibrary::EnsureInitialized()
mInitialized = true;
reporter.SetSuccessful();
return true;
}

View file

@ -6,7 +6,6 @@
#include "angle/Platform.h"
#include "gfxConfig.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Assertions.h"
@ -300,8 +299,6 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
return true;
}
mozilla::ScopedGfxFeatureReporter reporter("EGL");
#ifdef XP_WIN
if (!mEGLLibrary) {
// On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
@ -624,7 +621,6 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
}
mInitialized = true;
reporter.SetSuccessful();
return true;
}

View file

@ -19,7 +19,6 @@
#include "nsWindowsHelpers.h"
#include "gfxPrefs.h"
#include "gfxConfig.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/gfx/StackArray.h"
#include "mozilla/Services.h"
@ -181,8 +180,6 @@ CompositorD3D11::~CompositorD3D11()
bool
CompositorD3D11::Initialize(nsCString* const out_failureReason)
{
ScopedGfxFeatureReporter reporter("D3D11 Layers");
MOZ_ASSERT(gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING));
HRESULT hr;
@ -415,7 +412,6 @@ CompositorD3D11::Initialize(nsCString* const out_failureReason)
mAllowPartialPresents = CanUsePartialPresents(mDevice);
reporter.SetSuccessful();
return true;
}

View file

@ -15,7 +15,6 @@
#include "gfxFailure.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "gfxPrefs.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/gfx/DeviceManagerDx.h"
#include "mozilla/layers/CompositorBridgeParent.h"
@ -43,8 +42,6 @@ CompositorD3D9::~CompositorD3D9()
bool
CompositorD3D9::Initialize(nsCString* const out_failureReason)
{
ScopedGfxFeatureReporter reporter("D3D9 Layers");
mDeviceManager = DeviceManagerD3D9::Get();
if (!mDeviceManager) {
*out_failureReason = "FEATURE_FAILURE_D3D9_DEVICE_MANAGER";
@ -62,8 +59,6 @@ CompositorD3D9::Initialize(nsCString* const out_failureReason)
return false;
}
reporter.SetSuccessful();
return true;
}

View file

@ -12,7 +12,6 @@
#include "GLUploadHelpers.h"
#include "Layers.h" // for WriteSnapshotToDumpFile
#include "LayerScope.h" // for LayerScope
#include "gfxCrashReporterUtils.h" // for ScopedGfxFeatureReporter
#include "gfxEnv.h" // for gfxEnv
#include "gfxPlatform.h" // for gfxPlatform
#include "gfxPrefs.h" // for gfxPrefs
@ -225,8 +224,6 @@ CompositorOGL::CleanupResources()
bool
CompositorOGL::Initialize(nsCString* const out_failureReason)
{
ScopedGfxFeatureReporter reporter("GL Layers");
// Do not allow double initialization
MOZ_ASSERT(mGLContext == nullptr, "Don't reinitialize CompositorOGL");
@ -424,8 +421,6 @@ CompositorOGL::Initialize(nsCString* const out_failureReason)
console->LogStringMessage(msg.get());
}
reporter.SetSuccessful();
return true;
}

View file

@ -1,141 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxCrashReporterUtils.h"
#ifdef MOZ_GFXFEATUREREPORTER
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/StaticMutex.h"
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/RefPtr.h" // for RefPtr
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsError.h" // for NS_OK, NS_FAILED, nsresult
#include "nsExceptionHandler.h" // for AppendAppNotesToCrashReport
#include "nsID.h"
#include "nsIEventTarget.h" // for NS_DISPATCH_NORMAL
#include "nsIObserver.h" // for nsIObserver, etc
#include "nsIObserverService.h" // for nsIObserverService
#include "nsIRunnable.h" // for nsIRunnable
#include "nsISupports.h"
#include "nsTArray.h" // for nsTArray
#include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc
#include "nscore.h" // for NS_IMETHOD, NS_IMETHODIMP, etc
namespace mozilla {
static nsTArray<nsCString> *gFeaturesAlreadyReported = nullptr;
static StaticMutex gFeaturesAlreadyReportedMutex;
class ObserverToDestroyFeaturesAlreadyReported final : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
ObserverToDestroyFeaturesAlreadyReported() {}
private:
virtual ~ObserverToDestroyFeaturesAlreadyReported() {}
};
NS_IMPL_ISUPPORTS(ObserverToDestroyFeaturesAlreadyReported,
nsIObserver)
NS_IMETHODIMP
ObserverToDestroyFeaturesAlreadyReported::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
if (!strcmp(aTopic, "xpcom-shutdown")) {
StaticMutexAutoLock al(gFeaturesAlreadyReportedMutex);
if (gFeaturesAlreadyReported) {
delete gFeaturesAlreadyReported;
gFeaturesAlreadyReported = nullptr;
}
}
return NS_OK;
}
class RegisterObserverRunnable : public Runnable {
public:
NS_IMETHOD Run() override {
// LeakLog made me do this. Basically, I just wanted gFeaturesAlreadyReported to be a static nsTArray<nsCString>,
// and LeakLog was complaining about leaks like this:
// leaked 1 instance of nsTArray_base with size 8 bytes
// leaked 7 instances of nsStringBuffer with size 8 bytes each (56 bytes total)
// So this is a work-around using a pointer, and using a nsIObserver to deallocate on xpcom shutdown.
// Yay for fighting bloat.
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService)
return NS_OK;
RefPtr<ObserverToDestroyFeaturesAlreadyReported> observer = new ObserverToDestroyFeaturesAlreadyReported;
observerService->AddObserver(observer, "xpcom-shutdown", false);
return NS_OK;
}
};
class AppendAppNotesRunnable : public CancelableRunnable {
public:
explicit AppendAppNotesRunnable(const nsACString& aFeatureStr)
: mFeatureString(aFeatureStr)
{
}
NS_IMETHOD Run() override {
CrashReporter::AppendAppNotesToCrashReport(mFeatureString);
return NS_OK;
}
private:
nsAutoCString mFeatureString;
};
void
ScopedGfxFeatureReporter::WriteAppNote(char statusChar)
{
StaticMutexAutoLock al(gFeaturesAlreadyReportedMutex);
if (!gFeaturesAlreadyReported) {
gFeaturesAlreadyReported = new nsTArray<nsCString>;
nsCOMPtr<nsIRunnable> r = new RegisterObserverRunnable();
NS_DispatchToMainThread(r);
}
nsAutoCString featureString;
featureString.AppendPrintf("%s%c ",
mFeature,
statusChar);
if (!gFeaturesAlreadyReported->Contains(featureString)) {
gFeaturesAlreadyReported->AppendElement(featureString);
AppNote(featureString);
}
}
void
ScopedGfxFeatureReporter::AppNote(const nsACString& aMessage)
{
if (NS_IsMainThread()) {
CrashReporter::AppendAppNotesToCrashReport(aMessage);
} else {
nsCOMPtr<nsIRunnable> r = new AppendAppNotesRunnable(aMessage);
NS_DispatchToMainThread(r);
}
}
} // end namespace mozilla
#else
namespace mozilla {
void ScopedGfxFeatureReporter::WriteAppNote(char) {}
void ScopedGfxFeatureReporter::AppNote(const nsACString&) {}
} // namespace mozilla
#endif

View file

@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef gfxCrashReporterUtils_h__
#define gfxCrashReporterUtils_h__
#include "nsString.h"
namespace mozilla {
/** \class ScopedGfxFeatureReporter
*
* On creation, adds "FeatureName?" to AppNotes
* On destruction, adds "FeatureName-", or "FeatureName+" if you called SetSuccessful().
*
* Any such string is added at most once to AppNotes, and is subsequently skipped.
*
* This ScopedGfxFeatureReporter class is designed to be fool-proof to use in functions that
* have many exit points. We don't want to encourage having function with many exit points.
* It just happens that our graphics features initialization functions are like that.
*/
class ScopedGfxFeatureReporter
{
public:
explicit ScopedGfxFeatureReporter(const char *aFeature, bool aForce = false)
: mFeature(aFeature), mStatusChar('-')
{
WriteAppNote(aForce ? '!' : '?');
}
~ScopedGfxFeatureReporter() {
WriteAppNote(mStatusChar);
}
void SetSuccessful() { mStatusChar = '+'; }
static void AppNote(const nsACString& aMessage);
class AppNoteWritingRunnable;
protected:
const char *mFeature;
char mStatusChar;
private:
void WriteAppNote(char statusChar);
};
} // end namespace mozilla
#endif // gfxCrashReporterUtils_h__

View file

@ -16,7 +16,6 @@ DEFINES['MOZ_APP_VERSION'] = '"%s"' % CONFIG['MOZ_APP_VERSION']
EXPORTS += [
'DriverCrashGuard.h',
'FilterSupport.h',
'gfxCrashReporterUtils.h',
'gfxTelemetry.h',
'nsBoundingMetrics.h',
'nsColor.h',
@ -60,7 +59,6 @@ if CONFIG['MOZ_X11']:
UNIFIED_SOURCES += [
'DriverCrashGuard.cpp',
'FilterSupport.cpp',
'gfxCrashReporterUtils.cpp',
'gfxTelemetry.cpp',
'nsColor.cpp',
'nsFont.cpp',

View file

@ -389,7 +389,6 @@ DeviceManagerDx::CreateDevice(IDXGIAdapter* aAdapter,
void
DeviceManagerDx::CreateWARPCompositorDevice()
{
ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
HRESULT hr;
@ -434,7 +433,6 @@ DeviceManagerDx::CreateWARPCompositorDevice()
}
mCompositorDevice->SetExceptionMode(0);
reporterWARP.SetSuccessful();
}
FeatureStatus

View file

@ -34,8 +34,6 @@ struct ID3D11Device;
struct IDirectDraw7;
namespace mozilla {
class ScopedGfxFeatureReporter;
namespace gfx {
class FeatureState;

View file

@ -18,7 +18,6 @@
#include "mozilla/Logging.h"
#include "mozilla/Services.h"
#include "gfxCrashReporterUtils.h"
#include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "gfxEnv.h"
@ -650,7 +649,6 @@ gfxPlatform::Init()
gfxPrefs::CanvasAzureAccelerated(),
gfxPrefs::DisableGralloc(),
gfxPrefs::ForceShmemTiles());
ScopedGfxFeatureReporter::AppNote(forcedPrefs);
}
InitMoz2DLogging();

View file

@ -33,8 +33,6 @@
#include "nsIGfxInfo.h"
#include "gfxCrashReporterUtils.h"
#include "gfxGDIFontList.h"
#include "gfxGDIFont.h"
@ -414,7 +412,6 @@ gfxWindowsPlatform::InitDWriteSupport()
return false;
}
mozilla::ScopedGfxFeatureReporter reporter("DWrite");
decltype(DWriteCreateFactory)* createDWriteFactory = (decltype(DWriteCreateFactory)*)
GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory");
if (!createDWriteFactory) {
@ -436,7 +433,6 @@ gfxWindowsPlatform::InitDWriteSupport()
Factory::SetDWriteFactory(mDWriteFactory);
SetupClearTypeParams();
reporter.SetSuccessful();
return true;
}
@ -1619,8 +1615,6 @@ gfxWindowsPlatform::InitializeD2DConfig()
void
gfxWindowsPlatform::InitializeD2D()
{
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
FeatureState& d2d1 = gfxConfig::GetFeature(Feature::DIRECT2D);
DeviceManagerDx* dm = DeviceManagerDx::Get();
@ -1671,7 +1665,6 @@ gfxWindowsPlatform::InitializeD2D()
}
MOZ_ASSERT(d2d1.IsEnabled());
d2d1_1.SetSuccessful();
}
bool

View file

@ -13,7 +13,6 @@
*/
#include "cairo-win32.h"
#include "gfxCrashReporterUtils.h"
#include "gfxFontUtils.h"
#include "gfxWindowsSurface.h"
#include "gfxFont.h"