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

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

Issue 611153004: replace OVERRIDE and FINAL with override and final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CC_ -> BASE_ Created 6 years, 2 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
« no previous file with comments | « base/threading/thread_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.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Reset static data to initial state. Useful for tests, to ensure 59 // Reset static data to initial state. Useful for tests, to ensure
60 // they are independent. 60 // they are independent.
61 static void ResetStaticData(); 61 static void ResetStaticData();
62 62
63 private: 63 private:
64 class ThreadDelegate : public PlatformThread::Delegate { 64 class ThreadDelegate : public PlatformThread::Delegate {
65 public: 65 public:
66 explicit ThreadDelegate(Watchdog* watchdog) : watchdog_(watchdog) { 66 explicit ThreadDelegate(Watchdog* watchdog) : watchdog_(watchdog) {
67 } 67 }
68 virtual void ThreadMain() OVERRIDE; 68 virtual void ThreadMain() override;
69 private: 69 private:
70 void SetThreadName() const; 70 void SetThreadName() const;
71 71
72 Watchdog* watchdog_; 72 Watchdog* watchdog_;
73 }; 73 };
74 74
75 enum State {ARMED, DISARMED, SHUTDOWN, JOINABLE }; 75 enum State {ARMED, DISARMED, SHUTDOWN, JOINABLE };
76 76
77 bool enabled_; 77 bool enabled_;
78 78
79 Lock lock_; // Mutex for state_. 79 Lock lock_; // Mutex for state_.
80 ConditionVariable condition_variable_; 80 ConditionVariable condition_variable_;
81 State state_; 81 State state_;
82 const TimeDelta duration_; // How long after start_time_ do we alarm? 82 const TimeDelta duration_; // How long after start_time_ do we alarm?
83 const std::string thread_watched_name_; 83 const std::string thread_watched_name_;
84 PlatformThreadHandle handle_; 84 PlatformThreadHandle handle_;
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/thread_unittest.cc ('k') | base/threading/watchdog_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698