Bug 1578422: MOZ_DIAGNOSTIC_ASSERT when shared memory setup fails in CrashReporterClient::InitSingleton. r=gsvelto

This will help to catch changes that cause a loss of annotations without
affecting Release or Beta.
This also makes CrashReporterClient::InitSingleton return void as the previous
bool was ignored in all cases.

Differential Revision: https://phabricator.services.mozilla.com/D44642

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jed Davis 2019-09-04 12:42:41 +00:00
Родитель e3898f89a1
Коммит 4be263966f
1 изменённых файлов: 5 добавлений и 4 удалений

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

@ -7,6 +7,7 @@
#ifndef mozilla_ipc_CrashReporterClient_h
#define mozilla_ipc_CrashReporterClient_h
#include "mozilla/Assertions.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Unused.h"
@ -30,21 +31,21 @@ class CrashReporterClient {
// somewhere, and when the top-level actor's ActorDestroy runs (or when the
// crash reporter needs metadata), the shmem should be parsed.
template <typename T>
static bool InitSingleton(T* aToplevelProtocol) {
static void InitSingleton(T* aToplevelProtocol) {
// The crash reporter is not enabled in recording/replaying processes.
if (recordreplay::IsRecordingOrReplaying()) {
return true;
return;
}
Shmem shmem;
if (!AllocShmem(aToplevelProtocol, &shmem)) {
return false;
MOZ_DIAGNOSTIC_ASSERT(false, "failed to allocate crash reporter shmem");
return;
}
InitSingletonWithShmem(shmem);
Unused << aToplevelProtocol->SendInitCrashReporter(
std::move(shmem), CrashReporter::CurrentThreadId());
return true;
}
template <typename T>