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