| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // got no response (GotNoResponse) from the watched thread. Count includes the | 211 // got no response (GotNoResponse) from the watched thread. Count includes the |
| 212 // thread that got no response. | 212 // thread that got no response. |
| 213 base::Histogram* unresponsive_count_histogram_; | 213 base::Histogram* unresponsive_count_histogram_; |
| 214 | 214 |
| 215 // This counter tracks the unresponsiveness of watched thread. If this value | 215 // This counter tracks the unresponsiveness of watched thread. If this value |
| 216 // is zero then watched thread has responded with a pong message. This is | 216 // is zero then watched thread has responded with a pong message. This is |
| 217 // incremented by 1 when we got no response (GotNoResponse) from the watched | 217 // incremented by 1 when we got no response (GotNoResponse) from the watched |
| 218 // thread. | 218 // thread. |
| 219 int unresponsive_count_; | 219 int unresponsive_count_; |
| 220 | 220 |
| 221 // This is set to true when we would have crashed the browser because the |
| 222 // watched thread hasn't responded atleast 3 times. It is reset to false when |
| 223 // watched thread responds with a pong message. |
| 224 bool hung_processing_complete_; |
| 225 |
| 221 // We use this factory to create callback tasks for ThreadWatcher object. We | 226 // We use this factory to create callback tasks for ThreadWatcher object. We |
| 222 // use this during ping-pong messaging between WatchDog thread and watched | 227 // use this during ping-pong messaging between WatchDog thread and watched |
| 223 // thread. | 228 // thread. |
| 224 ScopedRunnableMethodFactory<ThreadWatcher> method_factory_; | 229 ScopedRunnableMethodFactory<ThreadWatcher> method_factory_; |
| 225 | 230 |
| 226 DISALLOW_COPY_AND_ASSIGN(ThreadWatcher); | 231 DISALLOW_COPY_AND_ASSIGN(ThreadWatcher); |
| 227 }; | 232 }; |
| 228 | 233 |
| 229 // Class with a list of all active thread watchers. A thread watcher is active | 234 // Class with a list of all active thread watchers. A thread watcher is active |
| 230 // if it has been registered, which includes determing the histogram name. This | 235 // if it has been registered, which includes determing the histogram name. This |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 366 |
| 362 DISALLOW_COPY_AND_ASSIGN(WatchDogThread); | 367 DISALLOW_COPY_AND_ASSIGN(WatchDogThread); |
| 363 }; | 368 }; |
| 364 | 369 |
| 365 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling | 370 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling |
| 366 // refcounting of ThreadWatcher and ThreadWatcherList classes. | 371 // refcounting of ThreadWatcher and ThreadWatcherList classes. |
| 367 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher); | 372 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher); |
| 368 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList); | 373 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList); |
| 369 | 374 |
| 370 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ | 375 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ |
| OLD | NEW |