| 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 #include "chrome/browser/jankometer.h" | 5 #include "chrome/browser/jankometer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const int kMaxIOMessageDelayMs = 200; | 41 const int kMaxIOMessageDelayMs = 200; |
| 42 #else | 42 #else |
| 43 const int kMaxUIMessageDelayMs = 500; | 43 const int kMaxUIMessageDelayMs = 500; |
| 44 const int kMaxIOMessageDelayMs = 400; | 44 const int kMaxIOMessageDelayMs = 400; |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 // Maximum processing time (excluding queueing delay) for a message before | 47 // Maximum processing time (excluding queueing delay) for a message before |
| 48 // considering it delayed. | 48 // considering it delayed. |
| 49 const int kMaxMessageProcessingMs = 100; | 49 const int kMaxMessageProcessingMs = 100; |
| 50 | 50 |
| 51 #if defined(OS_WIN) |
| 51 // TODO(brettw) Consider making this a pref. | 52 // TODO(brettw) Consider making this a pref. |
| 52 const bool kPlaySounds = false; | 53 const bool kPlaySounds = false; |
| 54 #endif |
| 53 | 55 |
| 54 //------------------------------------------------------------------------------ | 56 //------------------------------------------------------------------------------ |
| 55 // Provide a special watchdog to make it easy to set the breakpoint on this | 57 // Provide a special watchdog to make it easy to set the breakpoint on this |
| 56 // class only. | 58 // class only. |
| 57 class JankWatchdog : public base::Watchdog { | 59 class JankWatchdog : public base::Watchdog { |
| 58 public: | 60 public: |
| 59 JankWatchdog(const TimeDelta& duration, | 61 JankWatchdog(const TimeDelta& duration, |
| 60 const std::string& thread_watched_name, | 62 const std::string& thread_watched_name, |
| 61 bool enabled) | 63 bool enabled) |
| 62 : Watchdog(duration, thread_watched_name, enabled), | 64 : Watchdog(duration, thread_watched_name, enabled), |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 delete ui_observer; | 418 delete ui_observer; |
| 417 ui_observer = NULL; | 419 ui_observer = NULL; |
| 418 } | 420 } |
| 419 if (io_observer) { | 421 if (io_observer) { |
| 420 // IO thread can't be running when we remove observers. | 422 // IO thread can't be running when we remove observers. |
| 421 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); | 423 DCHECK((!g_browser_process) || !(g_browser_process->io_thread())); |
| 422 delete io_observer; | 424 delete io_observer; |
| 423 io_observer = NULL; | 425 io_observer = NULL; |
| 424 } | 426 } |
| 425 } | 427 } |
| OLD | NEW |