Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/metrics/thread_watcher.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 : live_threads_threshold(live_threads_threshold), 338 : live_threads_threshold(live_threads_threshold),
339 unresponsive_threshold(unresponsive_threshold) { 339 unresponsive_threshold(unresponsive_threshold) {
340 } 340 }
341 341
342 ThreadWatcherList::CrashDataThresholds::CrashDataThresholds() 342 ThreadWatcherList::CrashDataThresholds::CrashDataThresholds()
343 : live_threads_threshold(kLiveThreadsThreshold), 343 : live_threads_threshold(kLiveThreadsThreshold),
344 unresponsive_threshold(kUnresponsiveCount) { 344 unresponsive_threshold(kUnresponsiveCount) {
345 } 345 }
346 346
347 // static 347 // static
348 void ThreadWatcherList::StartWatchingAll(const CommandLine& command_line) { 348 void ThreadWatcherList::StartWatchingAll(
349 const base::CommandLine& command_line) {
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
350 uint32 unresponsive_threshold; 351 uint32 unresponsive_threshold;
351 CrashOnHangThreadMap crash_on_hang_threads; 352 CrashOnHangThreadMap crash_on_hang_threads;
352 ParseCommandLine(command_line, 353 ParseCommandLine(command_line,
353 &unresponsive_threshold, 354 &unresponsive_threshold,
354 &crash_on_hang_threads); 355 &crash_on_hang_threads);
355 356
356 ThreadWatcherObserver::SetupNotifications( 357 ThreadWatcherObserver::SetupNotifications(
357 base::TimeDelta::FromSeconds(kSleepSeconds * unresponsive_threshold)); 358 base::TimeDelta::FromSeconds(kSleepSeconds * unresponsive_threshold));
358 359
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 435 }
435 436
436 ThreadWatcherList::~ThreadWatcherList() { 437 ThreadWatcherList::~ThreadWatcherList() {
437 DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); 438 DCHECK(WatchDogThread::CurrentlyOnWatchDogThread());
438 DCHECK(this == g_thread_watcher_list_); 439 DCHECK(this == g_thread_watcher_list_);
439 g_thread_watcher_list_ = NULL; 440 g_thread_watcher_list_ = NULL;
440 } 441 }
441 442
442 // static 443 // static
443 void ThreadWatcherList::ParseCommandLine( 444 void ThreadWatcherList::ParseCommandLine(
444 const CommandLine& command_line, 445 const base::CommandLine& command_line,
445 uint32* unresponsive_threshold, 446 uint32* unresponsive_threshold,
446 CrashOnHangThreadMap* crash_on_hang_threads) { 447 CrashOnHangThreadMap* crash_on_hang_threads) {
447 // Initialize |unresponsive_threshold| to a default value. 448 // Initialize |unresponsive_threshold| to a default value.
448 *unresponsive_threshold = kUnresponsiveCount; 449 *unresponsive_threshold = kUnresponsiveCount;
449 450
450 // Increase the unresponsive_threshold on the Stable and Beta channels to 451 // Increase the unresponsive_threshold on the Stable and Beta channels to
451 // reduce the number of crashes due to ThreadWatcher. 452 // reduce the number of crashes due to ThreadWatcher.
452 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 453 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
453 if (channel == chrome::VersionInfo::CHANNEL_STABLE) { 454 if (channel == chrome::VersionInfo::CHANNEL_STABLE) {
454 *unresponsive_threshold *= 4; 455 *unresponsive_threshold *= 4;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 961
961 #if defined(OS_WIN) 962 #if defined(OS_WIN)
962 // On Windows XP, give twice the time for shutdown. 963 // On Windows XP, give twice the time for shutdown.
963 if (base::win::GetVersion() <= base::win::VERSION_XP) 964 if (base::win::GetVersion() <= base::win::VERSION_XP)
964 actual_duration *= 2; 965 actual_duration *= 2;
965 #endif 966 #endif
966 967
967 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); 968 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration);
968 shutdown_watchdog_->Arm(); 969 shutdown_watchdog_->Arm();
969 } 970 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_services_manager.cc ('k') | chrome/browser/metrics/thread_watcher_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698