Use CrashReporterHost/Client in the GPU process. (bug 1278717 part 3, r=billm)

This commit is contained in:
David Anderson 2016-10-11 14:25:41 -07:00
Родитель 37396f9500
Коммит 43c76f1bba
6 изменённых файлов: 41 добавлений и 1 удалений

Просмотреть файл

@ -144,6 +144,7 @@ LOCAL_INCLUDES += [
'/layout/base', '/layout/base',
'/media/webrtc', '/media/webrtc',
'/netwerk/base', '/netwerk/base',
'/toolkit/crashreporter',
'/toolkit/xre', '/toolkit/xre',
'/uriloader/exthandler', '/uriloader/exthandler',
'/widget', '/widget',

Просмотреть файл

@ -12,6 +12,7 @@
#if defined(XP_WIN) #if defined(XP_WIN)
# include "mozilla/gfx/DeviceManagerDx.h" # include "mozilla/gfx/DeviceManagerDx.h"
#endif #endif
#include "mozilla/ipc/CrashReporterHost.h"
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
@ -113,9 +114,27 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
return true; return true;
} }
bool
GPUChild::RecvInitCrashReporter(Shmem&& aShmem)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem);
#endif
return true;
}
void void
GPUChild::ActorDestroy(ActorDestroyReason aWhy) GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{ {
if (aWhy == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter) {
mCrashReporter->GenerateCrashReport(OtherPid());
mCrashReporter = nullptr;
}
#endif
}
gfxVars::RemoveReceiver(this); gfxVars::RemoveReceiver(this);
mHost->OnChannelClosed(); mHost->OnChannelClosed();
} }

Просмотреть файл

@ -12,6 +12,9 @@
#include "mozilla/gfx/gfxVarReceiver.h" #include "mozilla/gfx/gfxVarReceiver.h"
namespace mozilla { namespace mozilla {
namespace ipc {
class CrashReporterHost;
} // namespace
namespace gfx { namespace gfx {
class GPUProcessHost; class GPUProcessHost;
@ -34,6 +37,7 @@ public:
// PGPUChild overrides. // PGPUChild overrides.
bool RecvInitComplete(const GPUDeviceData& aData) override; bool RecvInitComplete(const GPUDeviceData& aData) override;
bool RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override; bool RecvReportCheckerboard(const uint32_t& aSeverity, const nsCString& aLog) override;
bool RecvInitCrashReporter(Shmem&& shmem) override;
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
bool RecvGraphicsError(const nsCString& aError) override; bool RecvGraphicsError(const nsCString& aError) override;
@ -41,6 +45,7 @@ public:
private: private:
GPUProcessHost* mHost; GPUProcessHost* mHost;
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
bool mGPUReady; bool mGPUReady;
}; };

Просмотреть файл

@ -13,6 +13,7 @@
#include "GPUProcessHost.h" #include "GPUProcessHost.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/gfx/gfxVars.h" #include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h" #include "mozilla/ipc/ProcessChild.h"
#include "mozilla/layers/APZThreadUtils.h" #include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/APZCTreeManager.h"
@ -27,6 +28,7 @@
#include "VRManager.h" #include "VRManager.h"
#include "VRManagerParent.h" #include "VRManagerParent.h"
#include "VsyncBridgeParent.h" #include "VsyncBridgeParent.h"
#include "nsExceptionHandler.h"
#if defined(XP_WIN) #if defined(XP_WIN)
# include "DeviceManagerD3D9.h" # include "DeviceManagerD3D9.h"
# include "mozilla/gfx/DeviceManagerDx.h" # include "mozilla/gfx/DeviceManagerDx.h"
@ -70,6 +72,11 @@ GPUParent::Init(base::ProcessId aParentPid,
nsDebugImpl::SetMultiprocessMode("GPU"); nsDebugImpl::SetMultiprocessMode("GPU");
#ifdef MOZ_CRASHREPORTER
// Init crash reporter support.
CrashReporterClient::InitSingleton(this);
#endif
// Ensure gfxPrefs are initialized. // Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton(); gfxPrefs::GetSingleton();
gfxConfig::Init(); gfxConfig::Init();
@ -320,6 +327,9 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown(); gfxVars::Shutdown();
gfxConfig::Shutdown(); gfxConfig::Shutdown();
gfxPrefs::DestroySingleton(); gfxPrefs::DestroySingleton();
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
NS_ShutdownXPCOM(nullptr); NS_ShutdownXPCOM(nullptr);
XRE_ShutdownChildProcess(); XRE_ShutdownChildProcess();
} }

Просмотреть файл

@ -78,6 +78,8 @@ child:
// Graphics errors, analogous to PContent::GraphicsError // Graphics errors, analogous to PContent::GraphicsError
async GraphicsError(nsCString aError); async GraphicsError(nsCString aError);
async InitCrashReporter(Shmem shmem);
}; };
} // namespace gfx } // namespace gfx

Просмотреть файл

@ -68,7 +68,10 @@ IPDL_SOURCES = [
'PVsyncBridge.ipdl', 'PVsyncBridge.ipdl',
] ]
LOCAL_INCLUDES += ['/dom/ipc'] LOCAL_INCLUDES += [
'/dom/ipc',
'/toolkit/crashreporter',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')