| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // The following are unique function names for forcing the crash when a thread | 33 // The following are unique function names for forcing the crash when a thread |
| 34 // is unresponsive. This makes it possible to tell from the callstack alone what | 34 // is unresponsive. This makes it possible to tell from the callstack alone what |
| 35 // thread was unresponsive. | 35 // thread was unresponsive. |
| 36 // | 36 // |
| 37 // We disable optimizations for this block of functions so the compiler doesn't | 37 // We disable optimizations for this block of functions so the compiler doesn't |
| 38 // merge them all together. | 38 // merge them all together. |
| 39 MSVC_DISABLE_OPTIMIZE() | 39 MSVC_DISABLE_OPTIMIZE() |
| 40 MSVC_PUSH_DISABLE_WARNING(4748) | 40 MSVC_PUSH_DISABLE_WARNING(4748) |
| 41 | 41 |
| 42 #ifndef NDEBUG |
| 42 int* NullPointer() { | 43 int* NullPointer() { |
| 43 return reinterpret_cast<int*>(NULL); | 44 return reinterpret_cast<int*>(NULL); |
| 44 } | 45 } |
| 46 #endif |
| 45 | 47 |
| 46 void NullPointerCrash(int line_number) { | 48 void NullPointerCrash(int line_number) { |
| 47 #ifndef NDEBUG | 49 #ifndef NDEBUG |
| 48 *NullPointer() = line_number; // Crash. | 50 *NullPointer() = line_number; // Crash. |
| 49 #else | 51 #else |
| 50 logging::DumpWithoutCrashing(); | 52 logging::DumpWithoutCrashing(); |
| 51 #endif | 53 #endif |
| 52 } | 54 } |
| 53 | 55 |
| 54 NOINLINE void ShutdownCrash() { | 56 NOINLINE void ShutdownCrash() { |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 983 |
| 982 #if defined(OS_WIN) | 984 #if defined(OS_WIN) |
| 983 // On Windows XP, give twice the time for shutdown. | 985 // On Windows XP, give twice the time for shutdown. |
| 984 if (base::win::GetVersion() <= base::win::VERSION_XP) | 986 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 985 actual_duration *= 2; | 987 actual_duration *= 2; |
| 986 #endif | 988 #endif |
| 987 | 989 |
| 988 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 990 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 989 shutdown_watchdog_->Arm(); | 991 shutdown_watchdog_->Arm(); |
| 990 } | 992 } |
| OLD | NEW |