From 4e368f8199a61c6319621ad1b9d6c352f0319f41 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 30 Mar 2018 08:50:58 +0200 Subject: Remove base conditional code for crash reporter and injector. --- xpcom/threads/nsThread.cpp | 79 ---------------------------------------------- 1 file changed, 79 deletions(-) (limited to 'xpcom/threads/nsThread.cpp') 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 #include @@ -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 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 } //----------------------------------------------------------------------------- -- cgit v1.2.3