OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_report_hang.h" | 5 #include "chrome/browser/metrics/thread_watcher_report_hang.h" |
6 | 6 |
7 // We disable optimizations for the whole file so the compiler doesn't merge | 7 // We disable optimizations for the whole file so the compiler doesn't merge |
8 // them all together. | 8 // them all together. |
9 MSVC_DISABLE_OPTIMIZE() | 9 MSVC_DISABLE_OPTIMIZE() |
10 MSVC_PUSH_DISABLE_WARNING(4748) | 10 MSVC_PUSH_DISABLE_WARNING(4748) |
11 | 11 |
12 #include "base/debug/debugger.h" | 12 #include "base/debug/debugger.h" |
13 #include "base/debug/dump_without_crashing.h" | 13 #include "base/debug/dump_without_crashing.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 | 15 |
16 namespace metrics { | 16 namespace metrics { |
17 | 17 |
18 // The following are unique function names for forcing the crash when a thread | 18 // The following are unique function names for forcing the crash when a thread |
19 // is unresponsive. This makes it possible to tell from the callstack alone what | 19 // is unresponsive. This makes it possible to tell from the callstack alone what |
20 // thread was unresponsive. | 20 // thread was unresponsive. |
21 NOINLINE void ReportThreadHang() { | 21 NOINLINE void ReportThreadHang() { |
22 volatile const char* inhibit_comdat = __FUNCTION__; | 22 volatile const char* inhibit_comdat = __func__; |
23 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 23 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
24 #if defined(NDEBUG) | 24 #if defined(NDEBUG) |
25 base::debug::DumpWithoutCrashing(); | 25 base::debug::DumpWithoutCrashing(); |
26 #else | 26 #else |
27 base::debug::BreakDebugger(); | 27 base::debug::BreakDebugger(); |
28 #endif | 28 #endif |
29 } | 29 } |
30 | 30 |
31 #if !defined(OS_ANDROID) || !defined(NDEBUG) | 31 #if !defined(OS_ANDROID) || !defined(NDEBUG) |
32 NOINLINE void StartupHang() { | 32 NOINLINE void StartupHang() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 else if (thread_id == 5) | 103 else if (thread_id == 5) |
104 return ThreadUnresponsive_CACHE(); | 104 return ThreadUnresponsive_CACHE(); |
105 else if (thread_id == 6) | 105 else if (thread_id == 6) |
106 return ThreadUnresponsive_IO(); | 106 return ThreadUnresponsive_IO(); |
107 } | 107 } |
108 | 108 |
109 } // namespace metrics | 109 } // namespace metrics |
110 | 110 |
111 MSVC_POP_WARNING() | 111 MSVC_POP_WARNING() |
112 MSVC_ENABLE_OPTIMIZE(); | 112 MSVC_ENABLE_OPTIMIZE(); |
OLD | NEW |