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

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

Issue 8453001: Remove 1 exit time destructor and 1 static initializer from watchdog.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments & leaky Created 9 years, 1 month 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 | « no previous file | base/threading/watchdog.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 // 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 Lock lock_; // Mutex for state_. 72 Lock lock_; // Mutex for state_.
73 ConditionVariable condition_variable_; 73 ConditionVariable condition_variable_;
74 State state_; 74 State state_;
75 const TimeDelta duration_; // How long after start_time_ do we alarm? 75 const TimeDelta duration_; // How long after start_time_ do we alarm?
76 const std::string thread_watched_name_; 76 const std::string thread_watched_name_;
77 PlatformThreadHandle handle_; 77 PlatformThreadHandle handle_;
78 ThreadDelegate delegate_; // Store it, because it must outlive the thread. 78 ThreadDelegate delegate_; // Store it, because it must outlive the thread.
79 79
80 TimeTicks start_time_; // Start of epoch, and alarm after duration_. 80 TimeTicks start_time_; // Start of epoch, and alarm after duration_.
81 81
82 // When the debugger breaks (when we alarm), all the other alarms that are
83 // armed will expire (also alarm). To diminish this effect, we track any
84 // delay due to debugger breaks, and we *try* to adjust the effective start
85 // time of other alarms to step past the debugging break.
86 // Without this safety net, any alarm will typically trigger a host of follow
87 // on alarms from callers that specify old times.
88 static Lock static_lock_; // Lock for access of static data...
89 // When did we last alarm and get stuck (for a while) in a debugger?
90 static TimeTicks last_debugged_alarm_time_;
91 // How long did we sit on a break in the debugger?
92 static TimeDelta last_debugged_alarm_delay_;
93
94 DISALLOW_COPY_AND_ASSIGN(Watchdog); 82 DISALLOW_COPY_AND_ASSIGN(Watchdog);
95 }; 83 };
96 84
97 } // namespace base 85 } // namespace base
98 86
99 #endif // BASE_THREADING_WATCHDOG_H_ 87 #endif // BASE_THREADING_WATCHDOG_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/watchdog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698