OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "chrome/browser/jankometer.h" | 7 #include "chrome/browser/jankometer.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/threading/watchdog.h" |
16 #include "base/thread.h" | 17 #include "base/thread.h" |
17 #include "base/time.h" | 18 #include "base/time.h" |
18 #include "base/watchdog.h" | |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_thread.h" | 21 #include "chrome/browser/browser_thread.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 | 23 |
24 #if defined(TOOLKIT_USES_GTK) | 24 #if defined(TOOLKIT_USES_GTK) |
25 #include "chrome/browser/gtk/gtk_util.h" | 25 #include "chrome/browser/gtk/gtk_util.h" |
26 #endif | 26 #endif |
27 | 27 |
28 using base::TimeDelta; | 28 using base::TimeDelta; |
(...skipping 19 matching lines...) Expand all Loading... |
48 // Maximum processing time (excluding queueing delay) for a message before | 48 // Maximum processing time (excluding queueing delay) for a message before |
49 // considering it delayed. | 49 // considering it delayed. |
50 const int kMaxMessageProcessingMs = 100; | 50 const int kMaxMessageProcessingMs = 100; |
51 | 51 |
52 // TODO(brettw) Consider making this a pref. | 52 // TODO(brettw) Consider making this a pref. |
53 const bool kPlaySounds = false; | 53 const bool kPlaySounds = false; |
54 | 54 |
55 //------------------------------------------------------------------------------ | 55 //------------------------------------------------------------------------------ |
56 // Provide a special watchdog to make it easy to set the breakpoint on this | 56 // Provide a special watchdog to make it easy to set the breakpoint on this |
57 // class only. | 57 // class only. |
58 class JankWatchdog : public Watchdog { | 58 class JankWatchdog : public base::Watchdog { |
59 public: | 59 public: |
60 JankWatchdog(const TimeDelta& duration, | 60 JankWatchdog(const TimeDelta& duration, |
61 const std::string& thread_watched_name, | 61 const std::string& thread_watched_name, |
62 bool enabled) | 62 bool enabled) |
63 : Watchdog(duration, thread_watched_name, enabled), | 63 : Watchdog(duration, thread_watched_name, enabled), |
64 thread_name_watched_(thread_watched_name), | 64 thread_name_watched_(thread_watched_name), |
65 alarm_count_(0) { | 65 alarm_count_(0) { |
66 } | 66 } |
67 | 67 |
68 virtual ~JankWatchdog() {} | 68 virtual ~JankWatchdog() {} |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 delete ui_observer; | 408 delete ui_observer; |
409 ui_observer = NULL; | 409 ui_observer = NULL; |
410 } | 410 } |
411 if (io_observer) { | 411 if (io_observer) { |
412 // IO thread can't be running when we remove observers. | 412 // IO thread can't be running when we remove observers. |
413 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); | 413 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); |
414 delete io_observer; | 414 delete io_observer; |
415 io_observer = NULL; | 415 io_observer = NULL; |
416 } | 416 } |
417 } | 417 } |
OLD | NEW |