diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-30 08:50:58 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-30 08:50:58 +0200 |
commit | 4e368f8199a61c6319621ad1b9d6c352f0319f41 (patch) | |
tree | 69c6e2296c4e183ecbe6cfd1e856619e3715ae01 /xpcom/threads | |
parent | 59bf4204a84f7638d3f89a29bc7c04e5dc401369 (diff) | |
download | UXP-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')
-rw-r--r-- | xpcom/threads/HangMonitor.cpp | 13 | ||||
-rw-r--r-- | xpcom/threads/nsThread.cpp | 79 | ||||
-rw-r--r-- | xpcom/threads/nsThread.h | 10 |
3 files changed, 0 insertions, 102 deletions
diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp index 71cc67ca4..bd415be50 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 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 } //----------------------------------------------------------------------------- diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h index 836123747..037ef1952 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); |