summaryrefslogtreecommitdiff
path: root/xpcom/threads
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-30 08:50:58 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-03-30 08:50:58 +0200
commit4e368f8199a61c6319621ad1b9d6c352f0319f41 (patch)
tree69c6e2296c4e183ecbe6cfd1e856619e3715ae01 /xpcom/threads
parent59bf4204a84f7638d3f89a29bc7c04e5dc401369 (diff)
downloaduxp-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar.gz
Remove base conditional code for crash reporter and injector.
Diffstat (limited to 'xpcom/threads')
-rw-r--r--xpcom/threads/HangMonitor.cpp13
-rw-r--r--xpcom/threads/nsThread.cpp79
-rw-r--r--xpcom/threads/nsThread.h10
3 files changed, 0 insertions, 102 deletions
diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp
index 71cc67ca4b..bd415be50e 100644
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -22,10 +22,6 @@
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -111,15 +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()) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
NS_RUNTIMEABORT("HangMonitor triggered");
}
diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp
index 63bd28ca38..7c1af08f48 100644
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -39,12 +39,6 @@
#include "nsThreadSyncDispatch.h"
#include "LeakRefPtr.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsServiceManagerUtils.h"
-#include "nsICrashReporter.h"
-#include "mozilla/dom/ContentChild.h"
-#endif
-
#ifdef XP_LINUX
#include <sys/time.h>
#include <sys/resource.h>
@@ -520,73 +514,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
-// than every 3 minutes
-// If |aShouldSave == kForceReport|, a report will be saved regardless of
-// whether the process is low on memory or not. However, it will still not be
-// saved if a report was saved less than 3 minutes ago.
-bool
-nsThread::SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave)
-{
- // Keep an eye on memory usage (cheap, ~7ms) somewhat frequently,
- // but save memory reports (expensive, ~75ms) less frequently.
- const size_t kLowMemoryCheckSeconds = 30;
- const size_t kLowMemorySaveSeconds = 3 * 60;
-
- static TimeStamp nextCheck = TimeStamp::NowLoRes()
- + TimeDuration::FromSeconds(kLowMemoryCheckSeconds);
- static bool recentlySavedReport = false; // Keeps track of whether a report
- // was saved last time we checked
-
- // Are we checking again too soon?
- TimeStamp now = TimeStamp::NowLoRes();
- if ((aShouldSave == ShouldSaveMemoryReport::kMaybeReport ||
- recentlySavedReport) && now < nextCheck) {
- return false;
- }
-
- bool needMemoryReport = (aShouldSave == ShouldSaveMemoryReport::kForceReport);
-#ifdef XP_WIN // XXX implement on other platforms as needed
- // If the report is forced there is no need to check whether it is necessary
- if (aShouldSave != ShouldSaveMemoryReport::kForceReport) {
- const size_t LOWMEM_THRESHOLD_VIRTUAL = 200 * 1024 * 1024;
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof(statex);
- if (GlobalMemoryStatusEx(&statex)) {
- if (statex.ullAvailVirtual < LOWMEM_THRESHOLD_VIRTUAL) {
- needMemoryReport = true;
- }
- }
- }
-#endif
-
- if (needMemoryReport) {
- if (XRE_IsContentProcess()) {
- dom::ContentChild* cc = dom::ContentChild::GetSingleton();
- if (cc) {
- cc->SendNotifyLowMemory();
- }
- } else {
- nsCOMPtr<nsICrashReporter> cr =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (cr) {
- cr->SaveMemoryReport();
- }
- }
- recentlySavedReport = true;
- nextCheck = now + TimeDuration::FromSeconds(kLowMemorySaveSeconds);
- } else {
- recentlySavedReport = false;
- nextCheck = now + TimeDuration::FromSeconds(kLowMemoryCheckSeconds);
- }
-
- return recentlySavedReport;
-}
-#endif
-
#ifdef MOZ_CANARY
int sCanaryOutputFD = -1;
#endif
@@ -1459,12 +1386,6 @@ nsThread::DoMainThreadSpecificProcessing(bool aReallyWait)
}
}
}
-
-#ifdef MOZ_CRASHREPORTER
- if (!ShuttingDown()) {
- SaveMemoryReportNearOOM(ShouldSaveMemoryReport::kMaybeReport);
- }
-#endif
}
//-----------------------------------------------------------------------------
diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h
index 836123747a..037ef1952f 100644
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -83,16 +83,6 @@ public:
void WaitForAllAsynchronousShutdowns();
-#ifdef MOZ_CRASHREPORTER
- enum class ShouldSaveMemoryReport
- {
- kMaybeReport,
- kForceReport
- };
-
- static bool SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave);
-#endif
-
private:
void DoMainThreadSpecificProcessing(bool aReallyWait);