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 #include "chrome/browser/metrics/thread_watcher.h" | 5 #include "chrome/browser/metrics/thread_watcher.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
11 #include "base/string_tokenizer.h" | 11 #include "base/string_tokenizer.h" |
12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/metrics/metrics_service.h" | 14 #include "chrome/browser/metrics/metrics_service.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
17 #include "chrome/common/logging_chrome.h" | 17 #include "chrome/common/logging_chrome.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
21 #endif | 21 #endif |
22 | 22 |
| 23 using content::BrowserThread; |
| 24 |
23 // ThreadWatcher methods and members. | 25 // ThreadWatcher methods and members. |
24 ThreadWatcher::ThreadWatcher(const WatchingParams& params) | 26 ThreadWatcher::ThreadWatcher(const WatchingParams& params) |
25 : thread_id_(params.thread_id), | 27 : thread_id_(params.thread_id), |
26 thread_name_(params.thread_name), | 28 thread_name_(params.thread_name), |
27 watched_loop_( | 29 watched_loop_( |
28 BrowserThread::GetMessageLoopProxyForThread(params.thread_id)), | 30 BrowserThread::GetMessageLoopProxyForThread(params.thread_id)), |
29 sleep_time_(params.sleep_time), | 31 sleep_time_(params.sleep_time), |
30 unresponsive_time_(params.unresponsive_time), | 32 unresponsive_time_(params.unresponsive_time), |
31 ping_time_(base::TimeTicks::Now()), | 33 ping_time_(base::TimeTicks::Now()), |
32 pong_time_(ping_time_), | 34 pong_time_(ping_time_), |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 791 |
790 #if defined(OS_WIN) | 792 #if defined(OS_WIN) |
791 // On Windows XP, give twice the time for shutdown. | 793 // On Windows XP, give twice the time for shutdown. |
792 if (base::win::GetVersion() <= base::win::VERSION_XP) | 794 if (base::win::GetVersion() <= base::win::VERSION_XP) |
793 actual_duration *= 2; | 795 actual_duration *= 2; |
794 #endif | 796 #endif |
795 | 797 |
796 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 798 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
797 shutdown_watchdog_->Arm(); | 799 shutdown_watchdog_->Arm(); |
798 } | 800 } |
OLD | NEW |