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/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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 // We disable optimizations for this block of functions so the compiler doesn't | 33 // We disable optimizations for this block of functions so the compiler doesn't |
34 // merge them all together. | 34 // merge them all together. |
35 | 35 |
36 // TODO(eroman): What is the equivalent for other compilers? | 36 // TODO(eroman): What is the equivalent for other compilers? |
37 #if defined(COMPILER_MSVC) | 37 #if defined(COMPILER_MSVC) |
38 #pragma optimize("", off) | 38 #pragma optimize("", off) |
39 MSVC_PUSH_DISABLE_WARNING(4748) | 39 MSVC_PUSH_DISABLE_WARNING(4748) |
40 #endif | 40 #endif |
41 | 41 |
42 void ThreadUnresponsive_UI() { | 42 void ThreadUnresponsive_UI() { |
43 CHECK(false); | 43 CHECK(false) << __FUNCTION__; |
eroman
2012/07/03 19:00:38
I am slightly surprised that CHECK(false) doesn't
Robert Sesek
2012/07/10 18:43:09
In official release builds, it looks like CHECK()
jar (doing other things)
2012/07/10 20:05:23
Reading the header file, it appears that they disc
| |
44 } | 44 } |
45 | 45 |
46 void ThreadUnresponsive_DB() { | 46 void ThreadUnresponsive_DB() { |
47 CHECK(false); | 47 CHECK(false) << __FUNCTION__; |
48 } | 48 } |
49 | 49 |
50 void ThreadUnresponsive_WEBKIT() { | 50 void ThreadUnresponsive_WEBKIT() { |
51 CHECK(false); | 51 CHECK(false) << __FUNCTION__; |
52 } | 52 } |
53 | 53 |
54 void ThreadUnresponsive_FILE() { | 54 void ThreadUnresponsive_FILE() { |
55 CHECK(false); | 55 CHECK(false) << __FUNCTION__; |
56 } | 56 } |
57 | 57 |
58 void ThreadUnresponsive_FILE_USER_BLOCKING() { | 58 void ThreadUnresponsive_FILE_USER_BLOCKING() { |
59 CHECK(false); | 59 CHECK(false) << __FUNCTION__; |
60 } | 60 } |
61 | 61 |
62 void ThreadUnresponsive_PROCESS_LAUNCHER() { | 62 void ThreadUnresponsive_PROCESS_LAUNCHER() { |
63 CHECK(false); | 63 CHECK(false) << __FUNCTION__; |
64 } | 64 } |
65 | 65 |
66 void ThreadUnresponsive_CACHE() { | 66 void ThreadUnresponsive_CACHE() { |
67 CHECK(false); | 67 CHECK(false) << __FUNCTION__; |
68 } | 68 } |
69 | 69 |
70 void ThreadUnresponsive_IO() { | 70 void ThreadUnresponsive_IO() { |
71 CHECK(false); | 71 CHECK(false) << __FUNCTION__; |
72 } | 72 } |
73 | 73 |
74 #if defined(COMPILER_MSVC) | 74 #if defined(COMPILER_MSVC) |
75 MSVC_POP_WARNING() | 75 MSVC_POP_WARNING() |
76 #pragma optimize("", on) | 76 #pragma optimize("", on) |
77 #endif | 77 #endif |
78 | 78 |
79 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { | 79 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { |
80 base::debug::Alias(&thread_id); | 80 base::debug::Alias(&thread_id); |
81 | 81 |
(...skipping 15 matching lines...) Expand all Loading... | |
97 case BrowserThread::IO: | 97 case BrowserThread::IO: |
98 return ThreadUnresponsive_IO(); | 98 return ThreadUnresponsive_IO(); |
99 case BrowserThread::ID_COUNT: | 99 case BrowserThread::ID_COUNT: |
100 CHECK(false); // This shouldn't actually be reached! | 100 CHECK(false); // This shouldn't actually be reached! |
101 break; | 101 break; |
102 | 102 |
103 // Omission of the default hander is intentional -- that way the compiler | 103 // Omission of the default hander is intentional -- that way the compiler |
104 // should warn if our switch becomes outdated. | 104 // should warn if our switch becomes outdated. |
105 } | 105 } |
106 | 106 |
107 CHECK(false); // Shouldn't be reached. | 107 CHECK(false) << "Unknown thread was unresponsive."; // Shouldn't be reached. |
108 } | 108 } |
109 | 109 |
110 } // namespace | 110 } // namespace |
111 | 111 |
112 // ThreadWatcher methods and members. | 112 // ThreadWatcher methods and members. |
113 ThreadWatcher::ThreadWatcher(const WatchingParams& params) | 113 ThreadWatcher::ThreadWatcher(const WatchingParams& params) |
114 : thread_id_(params.thread_id), | 114 : thread_id_(params.thread_id), |
115 thread_name_(params.thread_name), | 115 thread_name_(params.thread_name), |
116 watched_loop_( | 116 watched_loop_( |
117 BrowserThread::GetMessageLoopProxyForThread(params.thread_id)), | 117 BrowserThread::GetMessageLoopProxyForThread(params.thread_id)), |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
920 | 920 |
921 #if defined(OS_WIN) | 921 #if defined(OS_WIN) |
922 // On Windows XP, give twice the time for shutdown. | 922 // On Windows XP, give twice the time for shutdown. |
923 if (base::win::GetVersion() <= base::win::VERSION_XP) | 923 if (base::win::GetVersion() <= base::win::VERSION_XP) |
924 actual_duration *= 2; | 924 actual_duration *= 2; |
925 #endif | 925 #endif |
926 | 926 |
927 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 927 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
928 shutdown_watchdog_->Arm(); | 928 shutdown_watchdog_->Arm(); |
929 } | 929 } |
OLD | NEW |