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

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

Issue 8728035: Disarm StartupTimeBomb when it is deleted (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/thread_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file defines a WatchDog thread that monitors the responsiveness of other 5 // This file defines a WatchDog thread that monitors the responsiveness of other
6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines 6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines
7 // ThreadWatcher class which performs health check on threads that would like to 7 // ThreadWatcher class which performs health check on threads that would like to
8 // be watched. This file also defines ThreadWatcherList class that has list of 8 // be watched. This file also defines ThreadWatcherList class that has list of
9 // all active ThreadWatcher objects. 9 // all active ThreadWatcher objects.
10 // 10 //
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const base::Closure& task, 486 const base::Closure& task,
487 int64 delay_ms); 487 int64 delay_ms);
488 488
489 DISALLOW_COPY_AND_ASSIGN(WatchDogThread); 489 DISALLOW_COPY_AND_ASSIGN(WatchDogThread);
490 }; 490 };
491 491
492 // This is a wrapper class for getting the crash dumps of the hangs during 492 // This is a wrapper class for getting the crash dumps of the hangs during
493 // startup. 493 // startup.
494 class StartupTimeBomb { 494 class StartupTimeBomb {
495 public: 495 public:
496 // This singleton is instantiated when the browser process is launched.
497 StartupTimeBomb();
498
499 // Destructor disarm's startup_watchdog_ (if it is arm'ed) so that alarm
500 // doesn't go off.
501 ~StartupTimeBomb();
502
496 // Constructs |startup_watchdog_| which spawns a thread and starts timer. 503 // Constructs |startup_watchdog_| which spawns a thread and starts timer.
497 // |duration| specifies how long |startup_watchdog_| will wait before it 504 // |duration| specifies how long |startup_watchdog_| will wait before it
498 // calls alarm. 505 // calls alarm.
499 static void Arm(const base::TimeDelta& duration); 506 void Arm(const base::TimeDelta& duration);
500 507
501 // Disarms |startup_watchdog_| thread and then deletes it which stops the 508 // Disarms |startup_watchdog_| thread and then deletes it which stops the
502 // Watchdog thread. 509 // Watchdog thread.
503 static void Disarm(); 510 void Disarm();
504 511
505 private: 512 private:
513 friend class ThreadWatcherList;
jar (doing other things) 2011/11/30 01:02:01 nit: Why do we need this friend? Aren't the signi
ramant (doing other things) 2011/11/30 05:14:53 Added a static method to disarm the startup timebo
514
506 // Watches for hangs during startup until it is disarm'ed. 515 // Watches for hangs during startup until it is disarm'ed.
507 static base::Watchdog* startup_watchdog_; 516 base::Watchdog* startup_watchdog_;
517
518 // The singleton of this class.
519 static StartupTimeBomb* g_startup_timebomb_;
508 520
509 DISALLOW_COPY_AND_ASSIGN(StartupTimeBomb); 521 DISALLOW_COPY_AND_ASSIGN(StartupTimeBomb);
510 }; 522 };
511 523
512 // This is a wrapper class for detecting hangs during shutdown. 524 // This is a wrapper class for detecting hangs during shutdown.
513 class ShutdownWatcherHelper { 525 class ShutdownWatcherHelper {
514 public: 526 public:
515 // Create an empty holder for |shutdown_watchdog_|. 527 // Create an empty holder for |shutdown_watchdog_|.
516 ShutdownWatcherHelper(); 528 ShutdownWatcherHelper();
517 529
(...skipping 10 matching lines...) Expand all
528 540
529 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); 541 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper);
530 }; 542 };
531 543
532 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling 544 // DISABLE_RUNNABLE_METHOD_REFCOUNT is a convenience macro for disabling
533 // refcounting of ThreadWatcher and ThreadWatcherList classes. 545 // refcounting of ThreadWatcher and ThreadWatcherList classes.
534 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher); 546 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcher);
535 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList); 547 DISABLE_RUNNABLE_METHOD_REFCOUNT(ThreadWatcherList);
536 548
537 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ 549 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/thread_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698