Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7040)

Unified Diff: chrome/browser/metrics/thread_watcher.cc

Issue 269763002: ThreadWatcher - On Android, don't generate the crash dump if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/thread_watcher.cc
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
index ab80a8680dae484a3edb303576b5a17b35f8c631..23e33b979a4a96e19fd99232c636512f8a925668 100644
--- a/chrome/browser/metrics/thread_watcher.cc
+++ b/chrome/browser/metrics/thread_watcher.cc
@@ -53,6 +53,13 @@ void NullPointerCrash(int line_number) {
#endif
}
+#if !defined(OS_ANDROID) || !defined(NDEBUG)
+// TODO(rtenneti): Enabled crashing, after getting data.
+NOINLINE void StartupCrash() {
+ NullPointerCrash(__LINE__);
+}
+#endif // OS_ANDROID
+
NOINLINE void ShutdownCrash() {
NullPointerCrash(__LINE__);
}
@@ -882,20 +889,48 @@ class StartupWatchDogThread : public base::Watchdog {
// alarming.
explicit StartupWatchDogThread(const base::TimeDelta& duration)
: base::Watchdog(duration, "Startup watchdog thread", true) {
+#if defined(OS_ANDROID)
+ // TODO(rtenneti): Delete this code, after getting data.
+ start_time_clock_= base::Time::Now();
+ start_time_monotonic_ = base::TimeTicks::Now();
+ start_time_thread_now_ = base::TimeTicks::IsThreadNowSupported()
+ ? base::TimeTicks::ThreadNow() : base::TimeTicks::Now();
+#endif // OS_ANDROID
}
// Alarm is called if the time expires after an Arm() without someone calling
// Disarm(). When Alarm goes off, in release mode we get the crash dump
// without crashing and in debug mode we break into the debugger.
virtual void Alarm() OVERRIDE {
-#ifndef NDEBUG
- DCHECK(false);
-#else
- WatchDogThread::PostTask(FROM_HERE,
- base::Bind(&base::debug::DumpWithoutCrashing));
-#endif
+#if !defined(NDEBUG)
+ StartupCrash();
+ return;
+#elif !defined(OS_ANDROID)
+ WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupCrash));
+ return;
+#else // Android release: gather stats to figure out when to crash.
+ // TODO(rtenneti): Delete this code, after getting data.
+ UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeDuration",
+ base::Time::Now() - start_time_clock_);
+ UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeTicksDuration",
+ base::TimeTicks::Now() - start_time_monotonic_);
+ if (base::TimeTicks::IsThreadNowSupported()) {
+ UMA_HISTOGRAM_TIMES(
+ "StartupTimebomm.Alarm.ThreadNowDuration",
+ base::TimeTicks::ThreadNow() - start_time_thread_now_);
+ }
+ return;
+#endif // OS_ANDROID
}
+ private:
+#if defined(OS_ANDROID)
+ // TODO(rtenneti): Delete this code, after getting data.
+ base::Time start_time_clock_;
+ base::TimeTicks start_time_monotonic_;
+ base::TimeTicks start_time_thread_now_;
+#endif // OS_ANDROID
+
DISALLOW_COPY_AND_ASSIGN(StartupWatchDogThread);
};
@@ -916,6 +951,7 @@ class ShutdownWatchDogThread : public base::Watchdog {
ShutdownCrash();
}
+ private:
DISALLOW_COPY_AND_ASSIGN(ShutdownWatchDogThread);
};
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698