| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 NOINLINE void ThreadUnresponsive_UI() { | 58 NOINLINE void ThreadUnresponsive_UI() { |
| 59 NullPointerCrash(__LINE__); | 59 NullPointerCrash(__LINE__); |
| 60 } | 60 } |
| 61 | 61 |
| 62 NOINLINE void ThreadUnresponsive_DB() { | 62 NOINLINE void ThreadUnresponsive_DB() { |
| 63 NullPointerCrash(__LINE__); | 63 NullPointerCrash(__LINE__); |
| 64 } | 64 } |
| 65 | 65 |
| 66 NOINLINE void ThreadUnresponsive_WEBKIT() { | |
| 67 NullPointerCrash(__LINE__); | |
| 68 } | |
| 69 | |
| 70 NOINLINE void ThreadUnresponsive_FILE() { | 66 NOINLINE void ThreadUnresponsive_FILE() { |
| 71 NullPointerCrash(__LINE__); | 67 NullPointerCrash(__LINE__); |
| 72 } | 68 } |
| 73 | 69 |
| 74 NOINLINE void ThreadUnresponsive_FILE_USER_BLOCKING() { | 70 NOINLINE void ThreadUnresponsive_FILE_USER_BLOCKING() { |
| 75 NullPointerCrash(__LINE__); | 71 NullPointerCrash(__LINE__); |
| 76 } | 72 } |
| 77 | 73 |
| 78 NOINLINE void ThreadUnresponsive_PROCESS_LAUNCHER() { | 74 NOINLINE void ThreadUnresponsive_PROCESS_LAUNCHER() { |
| 79 NullPointerCrash(__LINE__); | 75 NullPointerCrash(__LINE__); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 91 MSVC_ENABLE_OPTIMIZE(); | 87 MSVC_ENABLE_OPTIMIZE(); |
| 92 | 88 |
| 93 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { | 89 void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { |
| 94 base::debug::Alias(&thread_id); | 90 base::debug::Alias(&thread_id); |
| 95 | 91 |
| 96 switch (thread_id) { | 92 switch (thread_id) { |
| 97 case BrowserThread::UI: | 93 case BrowserThread::UI: |
| 98 return ThreadUnresponsive_UI(); | 94 return ThreadUnresponsive_UI(); |
| 99 case BrowserThread::DB: | 95 case BrowserThread::DB: |
| 100 return ThreadUnresponsive_DB(); | 96 return ThreadUnresponsive_DB(); |
| 101 case BrowserThread::WEBKIT_DEPRECATED: | |
| 102 return ThreadUnresponsive_WEBKIT(); | |
| 103 case BrowserThread::FILE: | 97 case BrowserThread::FILE: |
| 104 return ThreadUnresponsive_FILE(); | 98 return ThreadUnresponsive_FILE(); |
| 105 case BrowserThread::FILE_USER_BLOCKING: | 99 case BrowserThread::FILE_USER_BLOCKING: |
| 106 return ThreadUnresponsive_FILE_USER_BLOCKING(); | 100 return ThreadUnresponsive_FILE_USER_BLOCKING(); |
| 107 case BrowserThread::PROCESS_LAUNCHER: | 101 case BrowserThread::PROCESS_LAUNCHER: |
| 108 return ThreadUnresponsive_PROCESS_LAUNCHER(); | 102 return ThreadUnresponsive_PROCESS_LAUNCHER(); |
| 109 case BrowserThread::CACHE: | 103 case BrowserThread::CACHE: |
| 110 return ThreadUnresponsive_CACHE(); | 104 return ThreadUnresponsive_CACHE(); |
| 111 case BrowserThread::IO: | 105 case BrowserThread::IO: |
| 112 return ThreadUnresponsive_IO(); | 106 return ThreadUnresponsive_IO(); |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 974 |
| 981 #if defined(OS_WIN) | 975 #if defined(OS_WIN) |
| 982 // On Windows XP, give twice the time for shutdown. | 976 // On Windows XP, give twice the time for shutdown. |
| 983 if (base::win::GetVersion() <= base::win::VERSION_XP) | 977 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 984 actual_duration *= 2; | 978 actual_duration *= 2; |
| 985 #endif | 979 #endif |
| 986 | 980 |
| 987 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 981 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 988 shutdown_watchdog_->Arm(); | 982 shutdown_watchdog_->Arm(); |
| 989 } | 983 } |
| OLD | NEW |