Bug 1402519 - Remove MOZ_CRASHREPORTER directives from xpcom; r=froydnj

MozReview-Commit-ID: HS3M0DJQ3qc

--HG--
extra : rebase_source : c535b0760480deea1c9889c629c52857bf52ea64
This commit is contained in:
Gabriele Svelto 2017-10-10 11:59:39 +02:00
Родитель cbb30621ec
Коммит 3e3a359edc
15 изменённых файлов: 20 добавлений и 86 удалений

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

@ -37,10 +37,6 @@
#include "nsWrapperCache.h"
#include "nsStringBuffer.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"

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

@ -81,6 +81,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollector.h"
#include "nsDOMJSUtils.h"
#include "nsExceptionHandler.h"
#include "nsJSUtils.h"
#include "nsWrapperCache.h"
#include "nsStringBuffer.h"
@ -90,10 +91,6 @@
#include "ProfilerMarkerPayload.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"
@ -545,10 +542,9 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSContext* aCx)
JS_SetExternalStringSizeofCallback(aCx, SizeofExternalStringCallback);
JS::SetBuildIdOp(aCx, GetBuildId);
JS::SetWarningReporter(aCx, MozCrashWarningReporter);
#ifdef MOZ_CRASHREPORTER
js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
CrashReporter::AnnotateOOMAllocationSize);
#endif
js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
CrashReporter::AnnotateOOMAllocationSize);
static js::DOMCallbacks DOMcallbacks = {
InstanceClassHasProtoAtDepth
@ -1447,7 +1443,6 @@ CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
OOMState aNewState)
{
*aStatePtr = aNewState;
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
? NS_LITERAL_CSTRING("JSOutOfMemory")
: NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
@ -1456,7 +1451,6 @@ CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
: aNewState == OOMState::Reported
? NS_LITERAL_CSTRING("Reported")
: NS_LITERAL_CSTRING("Recovered"));
#endif
}
void
@ -1469,14 +1463,12 @@ CycleCollectedJSRuntime::OnGC(JSContext* aContext,
mZonesWaitingForGC.Clear();
break;
case JSGC_END: {
#ifdef MOZ_CRASHREPORTER
if (mOutOfMemoryState == OOMState::Reported) {
AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Recovered);
}
if (mLargeAllocationFailureState == OOMState::Reported) {
AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Recovered);
}
#endif
// Do any deferred finalization of native objects. Normally we do this
// incrementally for an incremental GC, and immediately for a

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

@ -6,24 +6,21 @@
#include "nsCrashOnException.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
namespace mozilla {
static int
ReportException(EXCEPTION_POINTERS* aExceptionInfo)
{
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (cr) {
cr->WriteMinidumpForException(aExceptionInfo);
}
#endif
return EXCEPTION_EXECUTE_HANDLER;
}

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

@ -167,6 +167,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollectionNoteRootCallback.h"
#include "nsDeque.h"
#include "nsExceptionHandler.h"
#include "nsCycleCollector.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
@ -191,10 +192,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThreadLocal.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
struct NurseryPurpleBufferEntry
@ -668,14 +665,12 @@ PtrInfo::AnnotatedReleaseAssert(bool aCondition, const char* aMessage)
return;
}
#ifdef MOZ_CRASHREPORTER
const char* piName = "Unknown";
if (mParticipant) {
piName = mParticipant->ClassName();
}
nsPrintfCString msg("%s, for class %s", aMessage, piName);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
#endif
MOZ_CRASH();
}

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

@ -13,9 +13,7 @@
#include "MainThreadUtils.h"
#include "nsDebugImpl.h"
#include "nsDebug.h"
#ifdef MOZ_CRASHREPORTER
# include "nsExceptionHandler.h"
#endif
#include "nsExceptionHandler.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "prprf.h"
@ -392,7 +390,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
return;
case NS_DEBUG_ABORT: {
#if defined(MOZ_CRASHREPORTER)
// Updating crash annotations in the child causes us to do IPC. This can
// really cause trouble if we're asserting from within IPC code. So we
// have to do without the annotations in that case.
@ -406,7 +403,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
nsDependentCString(nonPIDBuf.buffer));
}
#endif // MOZ_CRASHREPORTER
#if defined(DEBUG) && defined(_WIN32)
RealBreak();
@ -614,8 +610,6 @@ NS_ErrorAccordingToNSPR()
void
NS_ABORT_OOM(size_t aSize)
{
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateOOMAllocationSize(aSize);
#endif
MOZ_CRASH("OOM");
}

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

@ -17,7 +17,7 @@
#import <ExceptionHandling/NSExceptionHandler.h>
#endif
#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
#if defined(__cplusplus)
#include "nsICrashReporter.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
@ -47,7 +47,7 @@ nsObjCExceptionLog(NSException* aException)
NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]",
[aException name], [aException reason]);
#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
#if defined(__cplusplus)
// Attach exception info to the crash report.
nsCOMPtr<nsICrashReporter> crashReporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");

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

@ -403,7 +403,6 @@ XRE_API(void,
XRE_API(void,
XRE_SetProcessType, (const char* aProcessTypeString))
#if defined(MOZ_CRASHREPORTER)
// Used in the "master" parent process hosting the crash server
XRE_API(bool,
XRE_TakeMinidumpForChild, (uint32_t aChildPid, nsIFile** aDump,
@ -412,7 +411,6 @@ XRE_API(bool,
// Used in child processes.
XRE_API(bool,
XRE_SetRemoteExceptionHandler, (const char* aPipe))
#endif
namespace mozilla {
namespace gmp {

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

@ -6,6 +6,7 @@
XPIDL_SOURCES += [
'nsIBlocklistService.idl',
'nsICrashReporter.idl',
'nsIDeviceSensors.idl',
'nsIGConfService.idl',
'nsIGeolocationProvider.idl',
@ -17,9 +18,4 @@ XPIDL_SOURCES += [
'nsIXULRuntime.idl',
]
if CONFIG['MOZ_CRASHREPORTER']:
XPIDL_SOURCES += [
'nsICrashReporter.idl',
]
XPIDL_MODULE = 'xpcom_system'

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

@ -8,20 +8,17 @@
#include "prthread.h"
#include "nsTArray.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsMemory.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "mozilla/CondVar.h"
#include "mozilla/RecursiveMutex.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/Mutex.h"
#ifdef MOZ_CRASHREPORTER
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#endif
#include "gtest/gtest.h"
using namespace mozilla;
@ -74,13 +71,11 @@ private:
void DisableCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
}
//-----------------------------------------------------------------------------

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

@ -6,6 +6,7 @@
#include "PLDHashTable.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#include "gtest/gtest.h"
@ -21,10 +22,6 @@
extern unsigned int _gdb_sleep_duration;
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
// We can test that certain operations cause expected aborts by forking
// and then checking that the child aborted in the expected way (i.e. via
// MOZ_CRASH). We skip this for the following configurations.
@ -49,13 +46,11 @@ TestCrashyOperation(void (*aCrashyOperation)())
// Disable the crashreporter -- writing a crash dump in the child will
// prevent the parent from writing a subsequent dump. Crashes here are
// expected, so we don't want their stacks to show up in the log anyway.
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
// Child: perform the crashy operation.
fprintf(stderr, "TestCrashyOperation: The following crash is expected. Do not panic.\n");

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

@ -10,11 +10,9 @@
# error "failed to wrap <vector>"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#endif
// gcc errors out if we |try ... catch| with -fno-exceptions, but we
// can still test on windows
@ -41,13 +39,11 @@ void ShouldAbort()
_gdb_sleep_duration = 0;
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
std::vector<int> v;
int rv = 1;

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

@ -14,6 +14,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsExceptionHandler.h"
#include "nsReadableUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/StackWalk.h"
@ -21,10 +22,6 @@
#include "nsXULAppAPI.h"
#include "GeckoProfiler.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@ -110,7 +107,6 @@ Crash()
}
#endif
#ifdef MOZ_CRASHREPORTER
// If you change this, you must also deal with the threadsafety of AnnotateCrashReport in
// non-chrome processes!
if (GeckoProcessType_Default == XRE_GetProcessType()) {
@ -118,7 +114,6 @@ Crash()
NS_LITERAL_CSTRING("1"));
CrashReporter::SetMinidumpAnalysisAllThreads();
}
#endif
MOZ_CRASH("HangMonitor triggered");
}

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

@ -38,16 +38,14 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsICrashReporter.h"
#include "nsThreadSyncDispatch.h"
#include "nsServiceManagerUtils.h"
#include "GeckoProfiler.h"
#include "InputEventStatistics.h"
#include "ThreadEventTarget.h"
#ifdef MOZ_CRASHREPORTER
#include "nsServiceManagerUtils.h"
#include "nsICrashReporter.h"
#include "mozilla/dom/ContentChild.h"
#endif
#ifdef XP_LINUX
#include <sys/time.h>
@ -476,7 +474,6 @@ nsThread::ThreadFunc(void* aArg)
//-----------------------------------------------------------------------------
#ifdef MOZ_CRASHREPORTER
// Tell the crash reporter to save a memory report if our heuristics determine
// that an OOM failure is likely to occur soon.
// Memory usage will not be checked more than every 30 seconds or saved more
@ -541,7 +538,6 @@ nsThread::SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave)
return recentlySavedReport;
}
#endif
#ifdef MOZ_CANARY
int sCanaryOutputFD = -1;
@ -1207,11 +1203,9 @@ nsThread::DoMainThreadSpecificProcessing(bool aReallyWait)
}
}
#ifdef MOZ_CRASHREPORTER
if (!ShuttingDown()) {
SaveMemoryReportNearOOM(ShouldSaveMemoryReport::kMaybeReport);
}
#endif
}
NS_IMETHODIMP

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

@ -87,7 +87,6 @@ public:
void WaitForAllAsynchronousShutdowns();
#ifdef MOZ_CRASHREPORTER
enum class ShouldSaveMemoryReport
{
kMaybeReport,
@ -95,7 +94,6 @@ public:
};
static bool SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave);
#endif
static const uint32_t kRunnableNameBufSize = 1000;
static mozilla::Array<char, kRunnableNameBufSize> sMainThreadRunnableName;

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

@ -10,10 +10,9 @@
#include "mozilla/TimeStamp.h"
#include "LeakRefPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsExceptionHandler.h"
#include "nsITimer.h"
#include "nsComponentManagerUtils.h"
#ifdef MOZILLA_INTERNAL_API
# include "nsThreadManager.h"
#else
@ -28,10 +27,6 @@
#include <sys/resource.h>
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
#ifndef XPCOM_GLUE_AVOID_NSPR
@ -517,9 +512,7 @@ void
NS_SetCurrentThreadName(const char* aName)
{
PR_SetCurrentThreadName(aName);
#ifdef MOZ_CRASHREPORTER
CrashReporter::SetCurrentThreadName(aName);
#endif
}
#ifdef MOZILLA_INTERNAL_API