Skip to content

Commit

Permalink
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from gfx; r=jrmuizel
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 7S8AJ18cCx0

--HG--
extra : rebase_source : 5fb4dbbd0416adeaf1796845e808b053ed029de4
  • Loading branch information
gabrielesvelto committed Oct 10, 2017
1 parent 13bba6b commit 6fc7fdc
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 61 deletions.
7 changes: 1 addition & 6 deletions gfx/gl/GfxTexturesReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@

#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;

Expand Down Expand Up @@ -76,7 +73,5 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
}
}

#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateTexturesSize(sAmount);
#endif
}
5 changes: 1 addition & 4 deletions gfx/ipc/GPUChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
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();
}

Expand Down Expand Up @@ -252,12 +251,10 @@ 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);
Expand Down
4 changes: 0 additions & 4 deletions gfx/ipc/GPUParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ GPUParent::Init(base::ProcessId aParentPid,
// versions.
GetIPCChannel()->SendBuildID();

#ifdef MOZ_CRASHREPORTER
// Init crash reporter support.
CrashReporterClient::InitSingleton(this);
#endif

// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
Expand Down Expand Up @@ -471,9 +469,7 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

Expand Down
9 changes: 1 addition & 8 deletions gfx/ipc/GPUProcessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@
#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"
Expand Down Expand Up @@ -368,15 +365,13 @@ GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost)
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
Expand Down Expand Up @@ -717,11 +712,9 @@ GPUProcessManager::DestroyProcess()
mVsyncBridge = nullptr;
}

#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Destroyed"));
#endif
}

already_AddRefed<CompositorSession>
Expand Down
6 changes: 0 additions & 6 deletions gfx/src/DriverCrashGuard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#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"
Expand Down Expand Up @@ -167,11 +165,9 @@ DriverCrashGuard::~DriverCrashGuard()
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
Expand Down Expand Up @@ -210,15 +206,13 @@ 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.
Expand Down
17 changes: 0 additions & 17 deletions gfx/src/gfxCrashReporterUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
* 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
Expand Down Expand Up @@ -137,13 +130,3 @@ ScopedGfxFeatureReporter::AppNote(const nsACString& aMessage)
}

} // end namespace mozilla

#else

namespace mozilla {
void ScopedGfxFeatureReporter::WriteAppNote(char) {}
void ScopedGfxFeatureReporter::AppNote(const nsACString&) {}

} // namespace mozilla

#endif
2 changes: 0 additions & 2 deletions gfx/tests/gtest/TestGfxPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ TEST(GfxPrefs, Set) {
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)
Expand All @@ -104,4 +103,3 @@ TEST(GfxPrefs, StringUtility)
// It won't fit into 32:
ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2));
}
#endif
9 changes: 2 additions & 7 deletions gfx/thebes/DeviceManagerDx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@
#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 {

Expand Down Expand Up @@ -772,12 +769,10 @@ DeviceManagerDx::MaybeResetAndReacquireDevices()
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;
Expand Down
9 changes: 2 additions & 7 deletions gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,14 @@
#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"

Expand Down Expand Up @@ -298,12 +296,9 @@ void CrashStatsLogForwarder::UpdateCrashReport()
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());
Expand Down

0 comments on commit 6fc7fdc

Please sign in to comment.