mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
2bc88d71e0
Crash annotations in content processes are currently sent over IPC via shared memory buffers. To pave the way for the Rust rewrite of the exception handler we are removing this code and gathering all the crash annotations within the content processes themselves. This patch causes annotations to be stored in the global table of each content process. They are then streamed out to the parent process by the exception handler together with the exception-time annotations. This has a number of benefits: * we have one less channel to exchange data between content processes and the parent process * we save memory because we don't need to allocate the shared memory buffers * annotations are faster because we don't stream them all out every time one changes * we won't truncate annotations anymore if we run out of space in the shared segment. * we don't need delayed annotations anymore, so we can get rid of the associated machinery As I refactored the code I tried to adjust all the obsolete comments, consolidate shared code and remove the redundant steps that were sometimes present. In many places we had two entire crash annotation tables we merged to change just a couple; that comes from the fact that historically we loaded them from disk. Now it doesn't matter anymore and we can just go ahead and change the ones we care about. Differential Revision: https://phabricator.services.mozilla.com/D62586 --HG-- extra : moz-landing-system : lando
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 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 "CrashReporterClient.h"
|
|
#include "nsISupportsImpl.h"
|
|
|
|
namespace mozilla {
|
|
namespace ipc {
|
|
|
|
StaticMutex CrashReporterClient::sLock;
|
|
StaticRefPtr<CrashReporterClient> CrashReporterClient::sClientSingleton;
|
|
|
|
CrashReporterClient::CrashReporterClient() {
|
|
MOZ_COUNT_CTOR(CrashReporterClient);
|
|
}
|
|
|
|
CrashReporterClient::~CrashReporterClient() {
|
|
MOZ_COUNT_DTOR(CrashReporterClient);
|
|
}
|
|
|
|
/* static */
|
|
void CrashReporterClient::InitSingleton() {
|
|
{
|
|
StaticMutexAutoLock lock(sLock);
|
|
|
|
MOZ_ASSERT(!sClientSingleton);
|
|
sClientSingleton = new CrashReporterClient();
|
|
}
|
|
}
|
|
|
|
/* static */
|
|
void CrashReporterClient::DestroySingleton() {
|
|
StaticMutexAutoLock lock(sLock);
|
|
sClientSingleton = nullptr;
|
|
}
|
|
|
|
/* static */
|
|
RefPtr<CrashReporterClient> CrashReporterClient::GetSingleton() {
|
|
StaticMutexAutoLock lock(sLock);
|
|
return sClientSingleton;
|
|
}
|
|
|
|
} // namespace ipc
|
|
} // namespace mozilla
|