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

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

Issue 7030020: Force a crash of the browser if IO thread hasn't responded (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « chrome/browser/metrics/thread_watcher.h ('k') | 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
===================================================================
--- chrome/browser/metrics/thread_watcher.cc (revision 85503)
+++ chrome/browser/metrics/thread_watcher.cc (working copy)
@@ -32,6 +32,7 @@
response_time_histogram_(NULL),
unresponsive_time_histogram_(NULL),
unresponsive_count_(0),
+ hung_processing_complete_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
Initialize();
}
@@ -232,6 +233,7 @@
void ThreadWatcher::GotGoodResponse() {
DCHECK(WatchDogThread::CurrentlyOnWatchDogThread());
unresponsive_count_ = 0;
+ hung_processing_complete_ = false;
}
void ThreadWatcher::GotNoResponse() {
@@ -246,6 +248,10 @@
base::TimeDelta unresponse_time = base::TimeTicks::Now() - pong_time_;
unresponsive_time_histogram_->AddTime(unresponse_time);
+ // We have already collected stats for the non-responding watched thread.
+ if (hung_processing_complete_)
+ return;
+
int no_of_responding_threads = 0;
int no_of_unresponding_threads = 0;
ThreadWatcherList::GetStatusOfThreads(&no_of_responding_threads,
@@ -256,6 +262,16 @@
// Record how many watched threads are not responding.
unresponsive_count_histogram_->Add(no_of_unresponding_threads);
+
+ // Crash the browser if IO thread hasn't responded atleast 3 times and if the
+ // number of other threads is equal to 1. We picked 1 to reduce the number of
+ // crashes and to get some sample data.
+ if (thread_id_ == BrowserThread::IO && no_of_responding_threads == 1) {
+ int* crash = NULL;
+ CHECK(crash++);
Peter Kasting 2011/05/17 00:41:05 Why is this better than simply NOTREACHED();?
+ }
+
+ hung_processing_complete_ = true;
}
// ThreadWatcherList methods and members.
« no previous file with comments | « chrome/browser/metrics/thread_watcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698