| 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" |
| 11 #include "base/debug/alias.h" | 11 #include "base/debug/alias.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
| 15 #include "base/string_tokenizer.h" | 15 #include "base/strings/string_tokenizer.h" |
| 16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/browser/metrics/metrics_service.h" | 18 #include "chrome/browser/metrics/metrics_service.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/dump_without_crashing.h" | 21 #include "chrome/common/dump_without_crashing.h" |
| 22 #include "chrome/common/logging_chrome.h" | 22 #include "chrome/common/logging_chrome.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 crash_on_hang_thread_names = ""; | 536 crash_on_hang_thread_names = ""; |
| 537 else | 537 else |
| 538 crash_on_hang_thread_names = "UI:3,IO:9"; | 538 crash_on_hang_thread_names = "UI:3,IO:9"; |
| 539 | 539 |
| 540 bool has_command_line_overwrite = false; | 540 bool has_command_line_overwrite = false; |
| 541 if (command_line.HasSwitch(switches::kCrashOnHangThreads)) { | 541 if (command_line.HasSwitch(switches::kCrashOnHangThreads)) { |
| 542 crash_on_hang_thread_names = | 542 crash_on_hang_thread_names = |
| 543 command_line.GetSwitchValueASCII(switches::kCrashOnHangThreads); | 543 command_line.GetSwitchValueASCII(switches::kCrashOnHangThreads); |
| 544 has_command_line_overwrite = true; | 544 has_command_line_overwrite = true; |
| 545 } | 545 } |
| 546 StringTokenizer tokens(crash_on_hang_thread_names, ","); | 546 base::StringTokenizer tokens(crash_on_hang_thread_names, ","); |
| 547 std::vector<std::string> values; | 547 std::vector<std::string> values; |
| 548 while (tokens.GetNext()) { | 548 while (tokens.GetNext()) { |
| 549 const std::string& token = tokens.token(); | 549 const std::string& token = tokens.token(); |
| 550 base::SplitString(token, ':', &values); | 550 base::SplitString(token, ':', &values); |
| 551 if (values.size() != 2) | 551 if (values.size() != 2) |
| 552 continue; | 552 continue; |
| 553 std::string thread_name = values[0]; | 553 std::string thread_name = values[0]; |
| 554 uint32 live_threads_threshold; | 554 uint32 live_threads_threshold; |
| 555 if (!base::StringToUint(values[1], &live_threads_threshold)) | 555 if (!base::StringToUint(values[1], &live_threads_threshold)) |
| 556 continue; | 556 continue; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 940 |
| 941 #if defined(OS_WIN) | 941 #if defined(OS_WIN) |
| 942 // On Windows XP, give twice the time for shutdown. | 942 // On Windows XP, give twice the time for shutdown. |
| 943 if (base::win::GetVersion() <= base::win::VERSION_XP) | 943 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 944 actual_duration *= 2; | 944 actual_duration *= 2; |
| 945 #endif | 945 #endif |
| 946 | 946 |
| 947 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 947 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 948 shutdown_watchdog_->Arm(); | 948 shutdown_watchdog_->Arm(); |
| 949 } | 949 } |
| OLD | NEW |