Skip to content

Commit

Permalink
Use CrashReporterHost/Client in the GPU process. (bug 1278717 part 3,…
Browse files Browse the repository at this point in the history
… r=billm)
  • Loading branch information
David Anderson committed Oct 11, 2016
1 parent 37396f9 commit 43c76f1
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions dom/ipc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ LOCAL_INCLUDES += [
'/layout/base',
'/media/webrtc',
'/netwerk/base',
'/toolkit/crashreporter',
'/toolkit/xre',
'/uriloader/exthandler',
'/widget',
Expand Down
19 changes: 19 additions & 0 deletions gfx/ipc/GPUChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#if defined(XP_WIN)
# include "mozilla/gfx/DeviceManagerDx.h"
#endif
#include "mozilla/ipc/CrashReporterHost.h"

namespace mozilla {
namespace gfx {
Expand Down Expand Up @@ -113,9 +114,27 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
return true;
}

bool
GPUChild::RecvInitCrashReporter(Shmem&& aShmem)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem);
#endif
return true;
}

void
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter) {
mCrashReporter->GenerateCrashReport(OtherPid());
mCrashReporter = nullptr;
}
#endif
}

gfxVars::RemoveReceiver(this);
mHost->OnChannelClosed();
}
Expand Down
5 changes: 5 additions & 0 deletions gfx/ipc/GPUChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include "mozilla/gfx/gfxVarReceiver.h"

namespace mozilla {
namespace ipc {
class CrashReporterHost;
} // namespace
namespace gfx {

class GPUProcessHost;
Expand All @@ -34,13 +37,15 @@ class GPUChild final
// PGPUChild overrides.
bool RecvInitComplete(const GPUDeviceData& aData) override;
bool RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override;
bool RecvInitCrashReporter(Shmem&& shmem) override;
void ActorDestroy(ActorDestroyReason aWhy) override;
bool RecvGraphicsError(const nsCString& aError) override;

static void Destroy(UniquePtr<GPUChild>&& aChild);

private:
GPUProcessHost* mHost;
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
bool mGPUReady;
};

Expand Down
10 changes: 10 additions & 0 deletions gfx/ipc/GPUParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "GPUProcessHost.h"
#include "mozilla/Assertions.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/APZCTreeManager.h"
Expand All @@ -27,6 +28,7 @@
#include "VRManager.h"
#include "VRManagerParent.h"
#include "VsyncBridgeParent.h"
#include "nsExceptionHandler.h"
#if defined(XP_WIN)
# include "DeviceManagerD3D9.h"
# include "mozilla/gfx/DeviceManagerDx.h"
Expand Down Expand Up @@ -70,6 +72,11 @@ GPUParent::Init(base::ProcessId aParentPid,

nsDebugImpl::SetMultiprocessMode("GPU");

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

// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
gfxConfig::Init();
Expand Down Expand Up @@ -320,6 +327,9 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
NS_ShutdownXPCOM(nullptr);
XRE_ShutdownChildProcess();
}
Expand Down
2 changes: 2 additions & 0 deletions gfx/ipc/PGPU.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ child:

// Graphics errors, analogous to PContent::GraphicsError
async GraphicsError(nsCString aError);

async InitCrashReporter(Shmem shmem);
};

} // namespace gfx
Expand Down
5 changes: 4 additions & 1 deletion gfx/ipc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ IPDL_SOURCES = [
'PVsyncBridge.ipdl',
]

LOCAL_INCLUDES += ['/dom/ipc']
LOCAL_INCLUDES += [
'/dom/ipc',
'/toolkit/crashreporter',
]

include('/ipc/chromium/chromium-config.mozbuild')

Expand Down

0 comments on commit 43c76f1

Please sign in to comment.