| OLD | NEW |
| 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 // 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // Note that even if the task is posted, there's no guarantee that it will | 448 // Note that even if the task is posted, there's no guarantee that it will |
| 449 // run, since the target thread may already have a Quit message in its queue. | 449 // run, since the target thread may already have a Quit message in its queue. |
| 450 static bool PostTask(const tracked_objects::Location& from_here, Task* task); | 450 static bool PostTask(const tracked_objects::Location& from_here, Task* task); |
| 451 static bool PostDelayedTask(const tracked_objects::Location& from_here, | 451 static bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 452 Task* task, | 452 Task* task, |
| 453 int64 delay_ms); | 453 int64 delay_ms); |
| 454 | 454 |
| 455 protected: | 455 protected: |
| 456 virtual void Init(); | 456 virtual void Init(); |
| 457 virtual void CleanUp(); | 457 virtual void CleanUp(); |
| 458 virtual void CleanUpAfterMessageLoopDestruction(); | |
| 459 | 458 |
| 460 private: | 459 private: |
| 461 static bool PostTaskHelper( | 460 static bool PostTaskHelper( |
| 462 const tracked_objects::Location& from_here, | 461 const tracked_objects::Location& from_here, |
| 463 Task* task, | 462 Task* task, |
| 464 int64 delay_ms); | 463 int64 delay_ms); |
| 465 | 464 |
| 466 // This lock protects watchdog_thread_. | 465 // This lock protects watchdog_thread_. |
| 467 static base::Lock lock_; | 466 static base::Lock lock_; |
| 468 | 467 |
| 469 static WatchDogThread* watchdog_thread_; // The singleton of this class. | 468 static WatchDogThread* watchdog_thread_; // The singleton of this class. |
| 470 | 469 |
| 471 DISALLOW_COPY_AND_ASSIGN(WatchDogThread); | 470 DISALLOW_COPY_AND_ASSIGN(WatchDogThread); |
| 472 }; | 471 }; |
| 473 | 472 |
| 474 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling | 473 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling |
| 475 // refcounting of ThreadWatcher and ThreadWatcherList classes. | 474 // refcounting of ThreadWatcher and ThreadWatcherList classes. |
| 476 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher); | 475 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher); |
| 477 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList); | 476 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList); |
| 478 | 477 |
| 479 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ | 478 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ |
| OLD | NEW |