gecko-dev/ipc/glue/CrashReporterMetadataShmem.h
Gabriele Svelto 76021a664b Bug 1555917 - Exception handler and crash reporter client cleanup r=froydnj
This patch includes multiple changes cleaning up various aspects of the crash
reporter client and exception handler:

* Some Unix-specific code was moved out from the base crashreporter client
  code and into the appropriate platform implementation
* Functions used to open files in the crashreporter client now accept C++
  `std::ios` flags instead of unreadable booleans
* Useless character conversion routines were removed from the
  minidump-analyzer
* Crash annotations are not serialized into a huge string anymore every time
  they change. They are all written out individually during an exception.
* `WriteEscapedMozCrashReason()` uses the exception-safe `my_strlen()` instead
  of plain `strlen()`
* The Windows-specific DLL-blocklist shutdown was removed from the Linux &
  macOS Breakpad callbacks
* The `CrashReporterHost`, `CrashReporterClient` and
  `CrashReporterMetadataShmem` classes now take `nsACString` references
  instead of `nsCString` ones since they never modify their contents

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

--HG--
extra : moz-landing-system : lando
2019-05-31 21:54:03 +00:00

48 lines
1.3 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/. */
#ifndef mozilla_ipc_CrashReporterMetadataShmem_h
#define mozilla_ipc_CrashReporterMetadataShmem_h
#include <stdint.h>
#include "mozilla/ipc/Shmem.h"
#include "nsExceptionHandler.h"
#include "nsString.h"
namespace mozilla {
namespace ipc {
class CrashReporterMetadataShmem {
typedef mozilla::ipc::Shmem Shmem;
typedef CrashReporter::AnnotationTable AnnotationTable;
public:
explicit CrashReporterMetadataShmem(const Shmem& aShmem);
~CrashReporterMetadataShmem();
// Metadata writers. These must only be called in child processes.
void AnnotateCrashReport(CrashReporter::Annotation aKey,
const nsACString& aData);
void AppendAppNotes(const nsACString& aData);
static void ReadAppNotes(const Shmem& aShmem,
CrashReporter::AnnotationTable& aNotes);
private:
void SyncNotesToShmem();
private:
Shmem mShmem;
AnnotationTable mAnnotations;
nsCString mAppNotes;
};
} // namespace ipc
} // namespace mozilla
#endif // mozilla_ipc_CrashReporterMetadataShmem_h