| OLD | NEW |
| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 CrashDataThresholds(); | 374 CrashDataThresholds(); |
| 375 | 375 |
| 376 uint32 live_threads_threshold; | 376 uint32 live_threads_threshold; |
| 377 uint32 unresponsive_threshold; | 377 uint32 unresponsive_threshold; |
| 378 }; | 378 }; |
| 379 typedef std::map<std::string, CrashDataThresholds> CrashOnHangThreadMap; | 379 typedef std::map<std::string, CrashDataThresholds> CrashOnHangThreadMap; |
| 380 | 380 |
| 381 // This method posts a task on WatchDogThread to start watching all browser | 381 // This method posts a task on WatchDogThread to start watching all browser |
| 382 // threads. | 382 // threads. |
| 383 // This method is accessible on UI thread. | 383 // This method is accessible on UI thread. |
| 384 static void StartWatchingAll(const CommandLine& command_line); | 384 static void StartWatchingAll(const base::CommandLine& command_line); |
| 385 | 385 |
| 386 // This method posts a task on WatchDogThread to RevokeAll tasks and to | 386 // This method posts a task on WatchDogThread to RevokeAll tasks and to |
| 387 // deactive thread watching of other threads and tell NotificationService to | 387 // deactive thread watching of other threads and tell NotificationService to |
| 388 // stop calling Observe. | 388 // stop calling Observe. |
| 389 // This method is accessible on UI thread. | 389 // This method is accessible on UI thread. |
| 390 static void StopWatchingAll(); | 390 static void StopWatchingAll(); |
| 391 | 391 |
| 392 // Register() stores a pointer to the given ThreadWatcher in a global map. | 392 // Register() stores a pointer to the given ThreadWatcher in a global map. |
| 393 static void Register(ThreadWatcher* watcher); | 393 static void Register(ThreadWatcher* watcher); |
| 394 | 394 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 418 // This singleton holds the global list of registered ThreadWatchers. | 418 // This singleton holds the global list of registered ThreadWatchers. |
| 419 ThreadWatcherList(); | 419 ThreadWatcherList(); |
| 420 | 420 |
| 421 // Destructor deletes all registered ThreadWatcher instances. | 421 // Destructor deletes all registered ThreadWatcher instances. |
| 422 virtual ~ThreadWatcherList(); | 422 virtual ~ThreadWatcherList(); |
| 423 | 423 |
| 424 // Parses the command line to get |crash_on_hang_threads| map from | 424 // Parses the command line to get |crash_on_hang_threads| map from |
| 425 // switches::kCrashOnHangThreads. |crash_on_hang_threads| is a map of | 425 // switches::kCrashOnHangThreads. |crash_on_hang_threads| is a map of |
| 426 // |crash_on_hang| thread's names to |CrashDataThresholds|. | 426 // |crash_on_hang| thread's names to |CrashDataThresholds|. |
| 427 static void ParseCommandLine( | 427 static void ParseCommandLine( |
| 428 const CommandLine& command_line, | 428 const base::CommandLine& command_line, |
| 429 uint32* unresponsive_threshold, | 429 uint32* unresponsive_threshold, |
| 430 CrashOnHangThreadMap* crash_on_hang_threads); | 430 CrashOnHangThreadMap* crash_on_hang_threads); |
| 431 | 431 |
| 432 // Parses the argument |crash_on_hang_thread_names| and creates | 432 // Parses the argument |crash_on_hang_thread_names| and creates |
| 433 // |crash_on_hang_threads| map of |crash_on_hang| thread's names to | 433 // |crash_on_hang_threads| map of |crash_on_hang| thread's names to |
| 434 // |CrashDataThresholds|. If |crash_on_hang_thread_names| doesn't specify | 434 // |CrashDataThresholds|. If |crash_on_hang_thread_names| doesn't specify |
| 435 // |live_threads_threshold|, then it uses |default_live_threads_threshold| as | 435 // |live_threads_threshold|, then it uses |default_live_threads_threshold| as |
| 436 // the value. If |crash_on_hang_thread_names| doesn't specify |crash_seconds|, | 436 // the value. If |crash_on_hang_thread_names| doesn't specify |crash_seconds|, |
| 437 // then it uses |default_crash_seconds| as the value. | 437 // then it uses |default_crash_seconds| as the value. |
| 438 static void ParseCommandLineCrashOnHangThreads( | 438 static void ParseCommandLineCrashOnHangThreads( |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 // shutdown_watchdog_ watches for hangs during shutdown. | 641 // shutdown_watchdog_ watches for hangs during shutdown. |
| 642 base::Watchdog* shutdown_watchdog_; | 642 base::Watchdog* shutdown_watchdog_; |
| 643 | 643 |
| 644 // The |thread_id_| on which this object is constructed. | 644 // The |thread_id_| on which this object is constructed. |
| 645 const base::PlatformThreadId thread_id_; | 645 const base::PlatformThreadId thread_id_; |
| 646 | 646 |
| 647 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); | 647 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); |
| 648 }; | 648 }; |
| 649 | 649 |
| 650 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ | 650 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ |
| OLD | NEW |