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

Side by Side Diff: chrome/browser/metrics/thread_watcher_unittest.cc

Issue 7134007: Added command line switches "crash-on-hang-threads" and "crash-on-hang-seconds" (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/synchronization/condition_variable.h" 10 #include "base/synchronization/condition_variable.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 CustomThreadWatcher* webkit_watcher_; 237 CustomThreadWatcher* webkit_watcher_;
238 238
239 ThreadWatcherTest() { 239 ThreadWatcherTest() {
240 webkit_thread_.reset(new BrowserThread(BrowserThread::WEBKIT)); 240 webkit_thread_.reset(new BrowserThread(BrowserThread::WEBKIT));
241 io_thread_.reset(new BrowserThread(BrowserThread::IO)); 241 io_thread_.reset(new BrowserThread(BrowserThread::IO));
242 watchdog_thread_.reset(new WatchDogThread()); 242 watchdog_thread_.reset(new WatchDogThread());
243 webkit_thread_->Start(); 243 webkit_thread_->Start();
244 io_thread_->Start(); 244 io_thread_->Start();
245 watchdog_thread_->Start(); 245 watchdog_thread_->Start();
246 246
247 CommandLine command_line(CommandLine::NO_PROGRAM);
jar (doing other things) 2011/06/10 00:38:33 Is there a nice way we can test this with some com
ramant (doing other things) 2011/06/13 03:26:02 Done.
248
247 // Setup the registry for thread watchers. 249 // Setup the registry for thread watchers.
248 thread_watcher_list_ = new ThreadWatcherList(); 250 thread_watcher_list_ = new ThreadWatcherList(command_line);
249 251
250 // Create thread watcher object for the IO thread. 252 // Create thread watcher object for the IO thread.
251 io_watcher_ = new CustomThreadWatcher(io_thread_id, io_thread_name, 253 io_watcher_ = new CustomThreadWatcher(io_thread_id, io_thread_name,
252 kSleepTime, kUnresponsiveTime); 254 kSleepTime, kUnresponsiveTime);
253 255
254 // Create thread watcher object for the WEBKIT thread. 256 // Create thread watcher object for the WEBKIT thread.
255 webkit_watcher_ = new CustomThreadWatcher( 257 webkit_watcher_ = new CustomThreadWatcher(
256 webkit_thread_id, webkit_thread_name, kSleepTime, kUnresponsiveTime); 258 webkit_thread_id, webkit_thread_name, kSleepTime, kUnresponsiveTime);
257 } 259 }
258 260
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 FROM_HERE, 458 FROM_HERE,
457 NewRunnableMethod(io_watcher_, &ThreadWatcher::DeActivateThreadWatching)); 459 NewRunnableMethod(io_watcher_, &ThreadWatcher::DeActivateThreadWatching));
458 WatchDogThread::PostTask( 460 WatchDogThread::PostTask(
459 FROM_HERE, 461 FROM_HERE,
460 NewRunnableMethod( 462 NewRunnableMethod(
461 webkit_watcher_, &ThreadWatcher::DeActivateThreadWatching)); 463 webkit_watcher_, &ThreadWatcher::DeActivateThreadWatching));
462 464
463 // Wait for the io_watcher_'s VeryLongMethod to finish. 465 // Wait for the io_watcher_'s VeryLongMethod to finish.
464 io_watcher_->WaitForWaitStateChange(kUnresponsiveTime * 10, ALL_DONE); 466 io_watcher_->WaitForWaitStateChange(kUnresponsiveTime * 10, ALL_DONE);
465 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698