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

Side by Side Diff: chrome/browser/metrics/thread_watcher.h

Issue 12356002: [NOT FOR COMMIT] Hacks to merge render compositor thread with UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « build/android/pylib/base/base_test_sharder.py ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file defines a WatchDog thread that monitors the responsiveness of other 5 // This file defines a WatchDog thread that monitors the responsiveness of other
6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines 6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines
7 // ThreadWatcher class which performs health check on threads that would like to 7 // ThreadWatcher class which performs health check on threads that would like to
8 // be watched. This file also defines ThreadWatcherList class that has list of 8 // be watched. This file also defines ThreadWatcherList class that has list of
9 // all active ThreadWatcher objects. 9 // all active ThreadWatcher objects.
10 // 10 //
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 static bool IsRegistered(const content::BrowserThread::ID thread_id); 396 static bool IsRegistered(const content::BrowserThread::ID thread_id);
397 397
398 // This method returns number of responsive and unresponsive watched threads. 398 // This method returns number of responsive and unresponsive watched threads.
399 static void GetStatusOfThreads(uint32* responding_thread_count, 399 static void GetStatusOfThreads(uint32* responding_thread_count,
400 uint32* unresponding_thread_count); 400 uint32* unresponding_thread_count);
401 401
402 // This will ensure that the watching is actively taking place, and awaken 402 // This will ensure that the watching is actively taking place, and awaken
403 // all thread watchers that are registered. 403 // all thread watchers that are registered.
404 static void WakeUpAll(); 404 static void WakeUpAll();
405 405
406 // This method calls ThreadWatcher::StartWatching() to perform health check on
407 // the given |thread_id|.
408 static void StartWatching(
boliu 2013/02/27 20:10:09 Oops, this has nothing to do with this patch.
409 const content::BrowserThread::ID& thread_id,
410 const std::string& thread_name,
411 const base::TimeDelta& sleep_time,
412 const base::TimeDelta& unresponsive_time,
413 uint32 unresponsive_threshold,
414 const CrashOnHangThreadMap& crash_on_hang_threads);
415
406 private: 416 private:
407 // Allow tests to access our innards for testing purposes. 417 // Allow tests to access our innards for testing purposes.
408 friend class CustomThreadWatcher; 418 friend class CustomThreadWatcher;
409 friend class ThreadWatcherTest; 419 friend class ThreadWatcherTest;
410 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesOnlyArgs); 420 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesOnlyArgs);
411 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesAndLiveThresholdArgs); 421 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesAndLiveThresholdArgs);
412 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, CrashOnHangThreadsAllArgs); 422 FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, CrashOnHangThreadsAllArgs);
413 423
414 // This singleton holds the global list of registered ThreadWatchers. 424 // This singleton holds the global list of registered ThreadWatchers.
415 ThreadWatcherList(); 425 ThreadWatcherList();
(...skipping 21 matching lines...) Expand all
437 uint32 default_crash_seconds, 447 uint32 default_crash_seconds,
438 CrashOnHangThreadMap* crash_on_hang_threads); 448 CrashOnHangThreadMap* crash_on_hang_threads);
439 449
440 // This constructs the |ThreadWatcherList| singleton and starts watching 450 // This constructs the |ThreadWatcherList| singleton and starts watching
441 // browser threads by calling StartWatching() on each browser thread that is 451 // browser threads by calling StartWatching() on each browser thread that is
442 // watched. It disarms StartupTimeBomb. 452 // watched. It disarms StartupTimeBomb.
443 static void InitializeAndStartWatching( 453 static void InitializeAndStartWatching(
444 uint32 unresponsive_threshold, 454 uint32 unresponsive_threshold,
445 const CrashOnHangThreadMap& crash_on_hang_threads); 455 const CrashOnHangThreadMap& crash_on_hang_threads);
446 456
447 // This method calls ThreadWatcher::StartWatching() to perform health check on
448 // the given |thread_id|.
449 static void StartWatching(
450 const content::BrowserThread::ID& thread_id,
451 const std::string& thread_name,
452 const base::TimeDelta& sleep_time,
453 const base::TimeDelta& unresponsive_time,
454 uint32 unresponsive_threshold,
455 const CrashOnHangThreadMap& crash_on_hang_threads);
456
457 // Delete all thread watcher objects and remove them from global map. It also 457 // Delete all thread watcher objects and remove them from global map. It also
458 // deletes |g_thread_watcher_list_|. 458 // deletes |g_thread_watcher_list_|.
459 static void DeleteAll(); 459 static void DeleteAll();
460 460
461 // The Find() method can be used to test to see if a given ThreadWatcher was 461 // The Find() method can be used to test to see if a given ThreadWatcher was
462 // already registered, or to retrieve a pointer to it from the global map. 462 // already registered, or to retrieve a pointer to it from the global map.
463 static ThreadWatcher* Find(const content::BrowserThread::ID& thread_id); 463 static ThreadWatcher* Find(const content::BrowserThread::ID& thread_id);
464 464
465 // The singleton of this class and is used to keep track of information about 465 // The singleton of this class and is used to keep track of information about
466 // threads that are being watched. 466 // threads that are being watched.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // shutdown_watchdog_ watches for hangs during shutdown. 624 // shutdown_watchdog_ watches for hangs during shutdown.
625 base::Watchdog* shutdown_watchdog_; 625 base::Watchdog* shutdown_watchdog_;
626 626
627 // The |thread_id_| on which this object is constructed. 627 // The |thread_id_| on which this object is constructed.
628 const base::PlatformThreadId thread_id_; 628 const base::PlatformThreadId thread_id_;
629 629
630 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); 630 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper);
631 }; 631 };
632 632
633 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ 633 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_
OLDNEW
« no previous file with comments | « build/android/pylib/base/base_test_sharder.py ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698