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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 crash_on_hang_threads); | 485 crash_on_hang_threads); |
486 } | 486 } |
487 | 487 |
488 // static | 488 // static |
489 void ThreadWatcherList::ParseCommandLineCrashOnHangThreads( | 489 void ThreadWatcherList::ParseCommandLineCrashOnHangThreads( |
490 const std::string& crash_on_hang_thread_names, | 490 const std::string& crash_on_hang_thread_names, |
491 uint32 default_live_threads_threshold, | 491 uint32 default_live_threads_threshold, |
492 uint32 default_crash_seconds, | 492 uint32 default_crash_seconds, |
493 CrashOnHangThreadMap* crash_on_hang_threads) { | 493 CrashOnHangThreadMap* crash_on_hang_threads) { |
494 base::StringTokenizer tokens(crash_on_hang_thread_names, ","); | 494 base::StringTokenizer tokens(crash_on_hang_thread_names, ","); |
495 std::vector<std::string> values; | |
496 while (tokens.GetNext()) { | 495 while (tokens.GetNext()) { |
497 const std::string& token = tokens.token(); | 496 std::vector<base::StringPiece> values = base::SplitStringPiece( |
498 base::SplitString(token, ':', &values); | 497 tokens.token_piece(), ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
499 std::string thread_name = values[0]; | 498 std::string thread_name = values[0].as_string(); |
500 | 499 |
501 uint32 live_threads_threshold = default_live_threads_threshold; | 500 uint32 live_threads_threshold = default_live_threads_threshold; |
502 uint32 crash_seconds = default_crash_seconds; | 501 uint32 crash_seconds = default_crash_seconds; |
503 if (values.size() >= 2 && | 502 if (values.size() >= 2 && |
504 (!base::StringToUint(values[1], &live_threads_threshold))) { | 503 (!base::StringToUint(values[1], &live_threads_threshold))) { |
505 continue; | 504 continue; |
506 } | 505 } |
507 if (values.size() >= 3 && | 506 if (values.size() >= 3 && |
508 (!base::StringToUint(values[2], &crash_seconds))) { | 507 (!base::StringToUint(values[2], &crash_seconds))) { |
509 continue; | 508 continue; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 | 929 |
931 #if defined(OS_WIN) | 930 #if defined(OS_WIN) |
932 // On Windows XP, give twice the time for shutdown. | 931 // On Windows XP, give twice the time for shutdown. |
933 if (base::win::GetVersion() <= base::win::VERSION_XP) | 932 if (base::win::GetVersion() <= base::win::VERSION_XP) |
934 actual_duration *= 2; | 933 actual_duration *= 2; |
935 #endif | 934 #endif |
936 | 935 |
937 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 936 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
938 shutdown_watchdog_->Arm(); | 937 shutdown_watchdog_->Arm(); |
939 } | 938 } |
OLD | NEW |