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

Side by Side Diff: base/threading/watchdog.h

Issue 18119002: Use a direct include of time headers in base/, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 7 years, 5 months 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 | « base/threading/sequenced_worker_pool_unittest.cc ('k') | base/threading/watchdog_unittest.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) 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 // The Watchdog class creates a second thread that can Alarm if a specific 5 // The Watchdog class creates a second thread that can Alarm if a specific
6 // duration of time passes without proper attention. The duration of time is 6 // duration of time passes without proper attention. The duration of time is
7 // specified at construction time. The Watchdog may be used many times by 7 // specified at construction time. The Watchdog may be used many times by
8 // simply calling Arm() (to start timing) and Disarm() (to reset the timer). 8 // simply calling Arm() (to start timing) and Disarm() (to reset the timer).
9 // The Watchdog is typically used under a debugger, where the stack traces on 9 // The Watchdog is typically used under a debugger, where the stack traces on
10 // other threads can be examined if/when the Watchdog alarms. 10 // other threads can be examined if/when the Watchdog alarms.
11 11
12 // Some watchdogs will be enabled or disabled via command line switches. To 12 // Some watchdogs will be enabled or disabled via command line switches. To
13 // facilitate such code, an "enabled" argument for the constuctor can be used 13 // facilitate such code, an "enabled" argument for the constuctor can be used
14 // to permanently disable the watchdog. Disabled watchdogs don't even spawn 14 // to permanently disable the watchdog. Disabled watchdogs don't even spawn
15 // a second thread, and their methods call (Arm() and Disarm()) return very 15 // a second thread, and their methods call (Arm() and Disarm()) return very
16 // quickly. 16 // quickly.
17 17
18 #ifndef BASE_THREADING_WATCHDOG_H_ 18 #ifndef BASE_THREADING_WATCHDOG_H_
19 #define BASE_THREADING_WATCHDOG_H_ 19 #define BASE_THREADING_WATCHDOG_H_
20 20
21 #include <string> 21 #include <string>
22 22
23 #include "base/base_export.h" 23 #include "base/base_export.h"
24 #include "base/compiler_specific.h" 24 #include "base/compiler_specific.h"
25 #include "base/synchronization/condition_variable.h" 25 #include "base/synchronization/condition_variable.h"
26 #include "base/synchronization/lock.h" 26 #include "base/synchronization/lock.h"
27 #include "base/threading/platform_thread.h" 27 #include "base/threading/platform_thread.h"
28 #include "base/time.h" 28 #include "base/time/time.h"
29 29
30 namespace base { 30 namespace base {
31 31
32 class BASE_EXPORT Watchdog { 32 class BASE_EXPORT Watchdog {
33 public: 33 public:
34 // Constructor specifies how long the Watchdog will wait before alarming. 34 // Constructor specifies how long the Watchdog will wait before alarming.
35 Watchdog(const TimeDelta& duration, 35 Watchdog(const TimeDelta& duration,
36 const std::string& thread_watched_name, 36 const std::string& thread_watched_name,
37 bool enabled); 37 bool enabled);
38 virtual ~Watchdog(); 38 virtual ~Watchdog();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ThreadDelegate delegate_; // Store it, because it must outlive the thread. 85 ThreadDelegate delegate_; // Store it, because it must outlive the thread.
86 86
87 TimeTicks start_time_; // Start of epoch, and alarm after duration_. 87 TimeTicks start_time_; // Start of epoch, and alarm after duration_.
88 88
89 DISALLOW_COPY_AND_ASSIGN(Watchdog); 89 DISALLOW_COPY_AND_ASSIGN(Watchdog);
90 }; 90 };
91 91
92 } // namespace base 92 } // namespace base
93 93
94 #endif // BASE_THREADING_WATCHDOG_H_ 94 #endif // BASE_THREADING_WATCHDOG_H_
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool_unittest.cc ('k') | base/threading/watchdog_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698