summaryrefslogtreecommitdiffstats
path: root/xpcom/threads/nsThread.cpp
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/nsThread.cpp
parent59bf4204a84f7638d3f89a29bc7c04e5dc401369 (diff)
downloadUXP-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar
UXP-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar.gz
UXP-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar.lz
UXP-4e368f8199a61c6319621ad1b9d6c352f0319f41.tar.xz
UXP-4e368f8199a61c6319621ad1b9d6c352f0319f41.zip
Remove base conditional code for crash reporter and injector.
Diffstat (limited to 'xpcom/threads/nsThread.cpp')
-rw-r--r--xpcom/threads/nsThread.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp
index 63bd28ca3..7c1af08f4 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
}
//-----------------------------------------------------------------------------