| 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 void Arm(const base::TimeDelta& duration); | 619 void Arm(const base::TimeDelta& duration); |
| 620 | 620 |
| 621 // Disarms |startup_watchdog_| thread and then deletes it which stops the | 621 // Disarms |startup_watchdog_| thread and then deletes it which stops the |
| 622 // Watchdog thread. | 622 // Watchdog thread. |
| 623 void Disarm(); | 623 void Disarm(); |
| 624 | 624 |
| 625 // Disarms |g_startup_timebomb_|. | 625 // Disarms |g_startup_timebomb_|. |
| 626 static void DisarmStartupTimeBomb(); | 626 static void DisarmStartupTimeBomb(); |
| 627 | 627 |
| 628 private: | 628 private: |
| 629 // Deletes |startup_watchdog_| if it is joinable. If |startup_watchdog_| is | 629 // Deletes the watchdog thread if it is joinable; otherwise it posts a delayed |
| 630 // not joinable, then it will post a delayed task to try again. | 630 // task to try again. |
| 631 void DeleteStartupWatchdog(); | 631 static void DeleteStartupWatchdog(const base::PlatformThreadId thread_id, |
| 632 base::Watchdog* startup_watchdog); |
| 632 | 633 |
| 633 // The singleton of this class. | 634 // The singleton of this class. |
| 634 static StartupTimeBomb* g_startup_timebomb_; | 635 static StartupTimeBomb* g_startup_timebomb_; |
| 635 | 636 |
| 636 // Watches for hangs during startup until it is disarm'ed. | 637 // Watches for hangs during startup until it is disarm'ed. |
| 637 base::Watchdog* startup_watchdog_; | 638 base::Watchdog* startup_watchdog_; |
| 638 | 639 |
| 639 // The |thread_id_| on which this object is constructed. | 640 // The |thread_id_| on which this object is constructed. |
| 640 const base::PlatformThreadId thread_id_; | 641 const base::PlatformThreadId thread_id_; |
| 641 | 642 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 // shutdown_watchdog_ watches for hangs during shutdown. | 688 // shutdown_watchdog_ watches for hangs during shutdown. |
| 688 base::Watchdog* shutdown_watchdog_; | 689 base::Watchdog* shutdown_watchdog_; |
| 689 | 690 |
| 690 // The |thread_id_| on which this object is constructed. | 691 // The |thread_id_| on which this object is constructed. |
| 691 const base::PlatformThreadId thread_id_; | 692 const base::PlatformThreadId thread_id_; |
| 692 | 693 |
| 693 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); | 694 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); |
| 694 }; | 695 }; |
| 695 | 696 |
| 696 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ | 697 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ |
| OLD | NEW |