| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ThreadUnresponsive_CACHE() { | 66 void ThreadUnresponsive_CACHE() { |
| 67 CHECK(false); | 67 CHECK(false); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ThreadUnresponsive_IO() { | 70 void ThreadUnresponsive_IO() { |
| 71 CHECK(false); | 71 CHECK(false); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ThreadUnresponsive_WEB_SOCKET_PROXY() { | |
| 75 CHECK(false); | |
| 76 } | |
| 77 | |
| 78 #if defined(COMPILER_MSVC) | 74 #if defined(COMPILER_MSVC) |
| 79 MSVC_POP_WARNING() | 75 MSVC_POP_WARNING() |
| 80 #pragma optimize("", on) | 76 #pragma optimize("", on) |
| 81 #endif | 77 #endif |
| 82 | 78 |
| 83 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { | 79 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { |
| 84 base::debug::Alias(&thread_id); | 80 base::debug::Alias(&thread_id); |
| 85 | 81 |
| 86 switch (thread_id) { | 82 switch (thread_id) { |
| 87 case BrowserThread::UI: | 83 case BrowserThread::UI: |
| 88 return ThreadUnresponsive_UI(); | 84 return ThreadUnresponsive_UI(); |
| 89 case BrowserThread::DB: | 85 case BrowserThread::DB: |
| 90 return ThreadUnresponsive_DB(); | 86 return ThreadUnresponsive_DB(); |
| 91 case BrowserThread::WEBKIT_DEPRECATED: | 87 case BrowserThread::WEBKIT_DEPRECATED: |
| 92 return ThreadUnresponsive_WEBKIT(); | 88 return ThreadUnresponsive_WEBKIT(); |
| 93 case BrowserThread::FILE: | 89 case BrowserThread::FILE: |
| 94 return ThreadUnresponsive_FILE(); | 90 return ThreadUnresponsive_FILE(); |
| 95 case BrowserThread::FILE_USER_BLOCKING: | 91 case BrowserThread::FILE_USER_BLOCKING: |
| 96 return ThreadUnresponsive_FILE_USER_BLOCKING(); | 92 return ThreadUnresponsive_FILE_USER_BLOCKING(); |
| 97 case BrowserThread::PROCESS_LAUNCHER: | 93 case BrowserThread::PROCESS_LAUNCHER: |
| 98 return ThreadUnresponsive_PROCESS_LAUNCHER(); | 94 return ThreadUnresponsive_PROCESS_LAUNCHER(); |
| 99 case BrowserThread::CACHE: | 95 case BrowserThread::CACHE: |
| 100 return ThreadUnresponsive_CACHE(); | 96 return ThreadUnresponsive_CACHE(); |
| 101 case BrowserThread::IO: | 97 case BrowserThread::IO: |
| 102 return ThreadUnresponsive_IO(); | 98 return ThreadUnresponsive_IO(); |
| 103 #if defined(OS_CHROMEOS) | |
| 104 case BrowserThread::WEB_SOCKET_PROXY: | |
| 105 return ThreadUnresponsive_WEB_SOCKET_PROXY(); | |
| 106 #endif | |
| 107 case BrowserThread::ID_COUNT: | 99 case BrowserThread::ID_COUNT: |
| 108 CHECK(false); // This shouldn't actually be reached! | 100 CHECK(false); // This shouldn't actually be reached! |
| 109 break; | 101 break; |
| 110 | 102 |
| 111 // Omission of the default hander is intentional -- that way the compiler | 103 // Omission of the default hander is intentional -- that way the compiler |
| 112 // should warn if our switch becomes outdated. | 104 // should warn if our switch becomes outdated. |
| 113 } | 105 } |
| 114 | 106 |
| 115 CHECK(false); // Shouldn't be reached. | 107 CHECK(false); // Shouldn't be reached. |
| 116 } | 108 } |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 | 903 |
| 912 #if defined(OS_WIN) | 904 #if defined(OS_WIN) |
| 913 // On Windows XP, give twice the time for shutdown. | 905 // On Windows XP, give twice the time for shutdown. |
| 914 if (base::win::GetVersion() <= base::win::VERSION_XP) | 906 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 915 actual_duration *= 2; | 907 actual_duration *= 2; |
| 916 #endif | 908 #endif |
| 917 | 909 |
| 918 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 910 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 919 shutdown_watchdog_->Arm(); | 911 shutdown_watchdog_->Arm(); |
| 920 } | 912 } |
| OLD | NEW |