Bug 1402519 - Remove MOZ_CRASHREPORTER directives from gfx; r?jrmuizel
MozReview-Commit-ID: 7S8AJ18cCx0
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -1,23 +1,20 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* 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 <string>
#include <sstream>
+#include "nsExceptionHandler.h"
#include "GfxTexturesReporter.h"
#include "gfxPrefs.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
using namespace mozilla;
using namespace mozilla::gl;
NS_IMPL_ISUPPORTS(GfxTexturesReporter, nsIMemoryReporter)
Atomic<size_t> GfxTexturesReporter::sAmount(0);
Atomic<size_t> GfxTexturesReporter::sPeakAmount(0);
Atomic<size_t> GfxTexturesReporter::sTileWasteAmount(0);
@@ -71,12 +68,10 @@ GfxTexturesReporter::UpdateAmount(Memory
if (sAmount > sPeakAmount) {
sPeakAmount.exchange(sAmount);
if (gfxPrefs::GfxLoggingPeakTextureUsageEnabled()) {
printf_stderr("Peak texture usage: %s\n", FormatBytes(sPeakAmount).c_str());
}
}
}
-#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateTexturesSize(sAmount);
-#endif
}
--- a/gfx/ipc/GPUChild.cpp
+++ b/gfx/ipc/GPUChild.cpp
@@ -140,22 +140,21 @@ GPUChild::RecvGraphicsError(const nsCStr
lf->UpdateStringsVector(message.str());
}
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
-#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GPU,
aShmem,
aThreadId);
-#endif
+
return IPC_OK();
}
mozilla::ipc::IPCResult
GPUChild::RecvNotifyUiObservers(const nsCString& aTopic)
{
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
MOZ_ASSERT(obsSvc);
@@ -248,22 +247,20 @@ GPUChild::RecvFinishMemoryReport(const u
}
return IPC_OK();
}
void
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
-#ifdef MOZ_CRASHREPORTER
if (mCrashReporter) {
mCrashReporter->GenerateCrashReport(OtherPid());
mCrashReporter = nullptr;
}
-#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU)), 1);
// Notify the Telemetry environment so that we can refresh and do a subsession split
if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) {
obsvc->NotifyObservers(nullptr, "compositor:process-aborted", nullptr);
}
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -94,20 +94,18 @@ GPUParent::Init(base::ProcessId aParentP
nsDebugImpl::SetMultiprocessMode("GPU");
// This must be sent before any IPDL message, which may hit sentinel
// errors due to parent and content processes having different
// versions.
GetIPCChannel()->SendBuildID();
-#ifdef MOZ_CRASHREPORTER
// Init crash reporter support.
CrashReporterClient::InitSingleton(this);
-#endif
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
gfxConfig::Init();
gfxVars::Initialize();
gfxPlatform::InitNullMetadata();
// Ensure our Factory is initialised, mainly for gfx logging to work.
gfxPlatform::InitMoz2DLogging();
@@ -441,16 +439,14 @@ GPUParent::ActorDestroy(ActorDestroyReas
Factory::ShutDown();
#if defined(XP_WIN)
DeviceManagerDx::Shutdown();
#endif
LayerTreeOwnerTracker::Shutdown();
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
-#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
-#endif
XRE_ShutdownChildProcess();
}
} // namespace gfx
} // namespace mozilla
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -34,22 +34,19 @@
#include "VRManagerChild.h"
#include "VRManagerParent.h"
#include "VsyncBridgeChild.h"
#include "VsyncIOThreadHolder.h"
#include "VsyncSource.h"
#include "mozilla/dom/VideoDecoderManagerChild.h"
#include "mozilla/dom/VideoDecoderManagerParent.h"
#include "MediaPrefs.h"
+#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
-#ifdef MOZ_CRASHREPORTER
-# include "nsExceptionHandler.h"
-#endif
-
#if defined(MOZ_WIDGET_ANDROID)
#include "mozilla/widget/AndroidUiThread.h"
#include "mozilla/layers/UiCompositorControllerChild.h"
#endif // defined(MOZ_WIDGET_ANDROID)
namespace mozilla {
namespace gfx {
@@ -362,25 +359,23 @@ GPUProcessManager::OnProcessLaunchComple
if (NS_FAILED(rv)) {
DisableGPUProcess("Failed to create PVsyncBridge endpoints");
return;
}
mVsyncBridge = VsyncBridgeChild::Create(mVsyncIOThread, mProcessToken, Move(vsyncChild));
mGPUChild->SendInitVsyncBridge(Move(vsyncParent));
-#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Running"));
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessLaunchCount"),
nsPrintfCString("%d", mNumProcessAttempts));
-#endif
}
static bool
ShouldLimitDeviceResets(uint32_t count, int32_t deltaMilliseconds)
{
// We decide to limit by comparing the amount of resets that have happened
// and time since the last reset to two prefs.
int32_t timeLimit = gfxPrefs::DeviceResetThresholdMilliseconds();
@@ -707,21 +702,19 @@ GPUProcessManager::DestroyProcess()
mProcessToken = 0;
mProcess = nullptr;
mGPUChild = nullptr;
if (mVsyncBridge) {
mVsyncBridge->Close();
mVsyncBridge = nullptr;
}
-#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Destroyed"));
-#endif
}
already_AddRefed<CompositorSession>
GPUProcessManager::CreateTopLevelCompositor(nsBaseWidget* aWidget,
LayerManager* aLayerManager,
CSSToLayoutDeviceScale aScale,
const CompositorOptions& aOptions,
bool aUseExternalSurfaceSize,
--- a/gfx/layers/ipc/CompositorThread.cpp
+++ b/gfx/layers/ipc/CompositorThread.cpp
@@ -1,57 +1,49 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 sts=2 ts=8 et tw=99 : */
/* 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 "CompositorThread.h"
#include "MainThreadUtils.h"
+#include "nsExceptionHandler.h" // for CrashReporter
#include "nsThreadUtils.h"
#include "CompositorBridgeParent.h"
#include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/media/MediaSystemResourceService.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h" // for CrashReporter
-#endif
namespace mozilla {
namespace gfx {
// See VRManagerChild.cpp
void ReleaseVRManagerParentSingleton();
} // namespace gfx
namespace layers {
-#ifdef MOZ_CRASHREPORTER
static Atomic<int32_t> sHoldersNextId(0);
-#endif
CompositorThreadHolderDebug::CompositorThreadHolderDebug(const char* aName)
: mHolder(CompositorThreadHolder::GetSingleton())
{
-#ifdef MOZ_CRASHREPORTER
if (XRE_IsParentProcess()) {
mId.AppendLiteral("gfxCTH:");
mId.Append(aName);
mId.AppendLiteral(":");
mId.AppendInt(++sHoldersNextId);
CrashReporter::AnnotateCrashReport(mId, NS_LITERAL_CSTRING("1"));
}
-#endif
}
CompositorThreadHolderDebug::~CompositorThreadHolderDebug()
{
-#ifdef MOZ_CRASHREPORTER
if (XRE_IsParentProcess()) {
CrashReporter::AnnotateCrashReport(mId, NS_LITERAL_CSTRING("0"));
}
-#endif
}
static StaticRefPtr<CompositorThreadHolder> sCompositorThreadHolder;
static bool sFinishedCompositorShutDown = false;
CompositorThreadHolder* GetCompositorThreadHolder()
{
return sCompositorThreadHolder;
--- a/gfx/layers/ipc/CompositorThread.h
+++ b/gfx/layers/ipc/CompositorThread.h
@@ -66,19 +66,17 @@ class CompositorThreadHolderDebug final
public:
explicit CompositorThreadHolderDebug(const char* aName);
private:
~CompositorThreadHolderDebug();
RefPtr<CompositorThreadHolder> mHolder;
-#ifdef MOZ_CRASHREPORTER
nsAutoCString mId;
-#endif
};
base::Thread* CompositorThread();
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_CompositorThread_h
--- a/gfx/src/DriverCrashGuard.cpp
+++ b/gfx/src/DriverCrashGuard.cpp
@@ -3,19 +3,17 @@
* 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 "DriverCrashGuard.h"
#include "gfxEnv.h"
#include "gfxPrefs.h"
#include "gfxConfig.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
-#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/dom/ContentChild.h"
@@ -161,21 +159,19 @@ DriverCrashGuard::~DriverCrashGuard()
// proceed to mark the status as okay.
if (GetStatus() != DriverInitStatus::Crashed) {
SetStatus(DriverInitStatus::Okay);
}
} else {
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
-#ifdef MOZ_CRASHREPORTER
// Remove the crash report annotation.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING(""));
-#endif
}
bool
DriverCrashGuard::Crashed()
{
InitializeIfNeeded();
// Note, we read mCrashDetected instead of GetStatus(), since in child
@@ -204,25 +200,23 @@ DriverCrashGuard::GetGuardFile()
return file;
}
void
DriverCrashGuard::ActivateGuard()
{
mGuardActivated = true;
-#ifdef MOZ_CRASHREPORTER
// Anotate crash reports only if we're a real guard. Otherwise, we could
// attribute a random parent process crash to a graphics problem in a child
// process.
if (mMode != Mode::Proxy) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING("1"));
}
-#endif
// If we're in the content process, the rest of the guarding is handled
// in the parent.
if (XRE_IsContentProcess()) {
return;
}
SetStatus(DriverInitStatus::Attempting);
--- a/gfx/src/gfxCrashReporterUtils.cpp
+++ b/gfx/src/gfxCrashReporterUtils.cpp
@@ -1,21 +1,14 @@
/* -*- 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"
-
-#if defined(MOZ_CRASHREPORTER)
-#define MOZ_GFXFEATUREREPORTER 1
-#endif
-
-#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/SystemGroup.h" // for SystemGroup
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/RefPtr.h" // for RefPtr
#include "MainThreadUtils.h" // for NS_IsMainThread
@@ -131,18 +124,8 @@ ScopedGfxFeatureReporter::AppNote(const
CrashReporter::AppendAppNotesToCrashReport(aMessage);
} else {
nsCOMPtr<nsIRunnable> r = new AppendAppNotesRunnable(aMessage);
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
}
}
} // end namespace mozilla
-
-#else
-
-namespace mozilla {
-void ScopedGfxFeatureReporter::WriteAppNote(char) {}
-void ScopedGfxFeatureReporter::AppNote(const nsACString&) {}
-
-} // namespace mozilla
-
-#endif
--- a/gfx/tests/gtest/TestGfxPrefs.cpp
+++ b/gfx/tests/gtest/TestGfxPrefs.cpp
@@ -75,17 +75,16 @@ TEST(GfxPrefs, Set) {
// Once float, default -1
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
gfxPrefs::SetAPZMaxVelocity(1.75f);
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == 1.75f);
gfxPrefs::SetAPZMaxVelocity(-1.0f);
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
}
-#ifdef MOZ_CRASHREPORTER
// Randomly test the function we use in nsExceptionHandler.cpp here:
extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
TEST(GfxPrefs, StringUtility)
{
char testBuffer[64];
double testVal[] = {13.4,
3324243.42,
0.332424342,
@@ -98,9 +97,8 @@ TEST(GfxPrefs, StringUtility)
}
// We do not like negative numbers (random limitation)
ASSERT_FALSE(SimpleNoCLibDtoA(-864.0, testBuffer, sizeof(testBuffer)));
// It won't fit into 32:
ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2));
}
-#endif
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -16,26 +16,23 @@
#include "mozilla/gfx/GraphicsMessages.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/DeviceAttachmentsD3D11.h"
#include "mozilla/layers/MLGDeviceD3D11.h"
#include "mozilla/layers/PaintThread.h"
+#include "nsExceptionHandler.h"
#include "nsIGfxInfo.h"
+#include "nsPrintfCString.h"
#include "nsString.h"
#include <d3d11.h>
#include <ddraw.h>
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsPrintfCString.h"
-#endif
-
namespace mozilla {
namespace gfx {
using namespace mozilla::widget;
using namespace mozilla::layers;
StaticAutoPtr<DeviceManagerDx> DeviceManagerDx::sInstance;
@@ -767,22 +764,20 @@ DeviceManagerDx::MaybeResetAndReacquireD
if (!HasDeviceReset(&resetReason)) {
return false;
}
if (resetReason != DeviceResetReason::FORCED_RESET) {
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
}
-#ifdef MOZ_CRASHREPORTER
nsPrintfCString reasonString("%d", int(resetReason));
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("DeviceResetReason"),
reasonString);
-#endif
bool createCompositorDevice = !!mCompositorDevice;
bool createContentDevice = !!mContentDevice;
ResetDevices();
if (createCompositorDevice && !CreateCompositorDevices()) {
// Just stop, don't try anything more
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -63,26 +63,24 @@
#include "gfxImageSurface.h"
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#include "gfxGraphiteShaper.h"
#include "gfx2DGlue.h"
#include "gfxGradientCache.h"
#include "gfxUtils.h" // for NextPowerOfTwo
+#include "nsExceptionHandler.h"
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "nsIObserverService.h"
#include "nsIScreenManager.h"
#include "FrameMetrics.h"
#include "MainThreadUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsWeakReference.h"
#include "cairo.h"
#include "qcms.h"
#include "imgITools.h"
@@ -291,22 +289,19 @@ void CrashStatsLogForwarder::UpdateCrash
logAnnotation = "|[X";
break;
}
for (auto& it : mBuffer) {
message << logAnnotation << Get<0>(it) << "]" << Get<1>(it) << " (t=" << Get<2>(it) << ") ";
}
-#ifdef MOZ_CRASHREPORTER
nsCString reportString(message.str().c_str());
nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
-#else
- nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
-#endif
+
if (annotated != NS_OK) {
printf("Crash Annotation %s: %s",
mCrashCriticalKey.get(), message.str().c_str());
}
}
class LogForwarderEvent : public Runnable
{