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

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

Issue 9192024: Add a convenience typedef LazyInstance<T>::Leaky to avoid repeating T. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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/nix/mime_util_xdg.cc ('k') | base/tracked_objects.h » ('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 #include "base/threading/watchdog.h" 5 #include "base/threading/watchdog.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 namespace { 14 namespace {
15 15
16 // When the debugger breaks (when we alarm), all the other alarms that are 16 // When the debugger breaks (when we alarm), all the other alarms that are
17 // armed will expire (also alarm). To diminish this effect, we track any 17 // armed will expire (also alarm). To diminish this effect, we track any
18 // delay due to debugger breaks, and we *try* to adjust the effective start 18 // delay due to debugger breaks, and we *try* to adjust the effective start
19 // time of other alarms to step past the debugging break. 19 // time of other alarms to step past the debugging break.
20 // Without this safety net, any alarm will typically trigger a host of follow 20 // Without this safety net, any alarm will typically trigger a host of follow
21 // on alarms from callers that specify old times. 21 // on alarms from callers that specify old times.
22 22
23 // Lock for access of static data... 23 // Lock for access of static data...
24 LazyInstance<Lock, LeakyLazyInstanceTraits<Lock> > g_static_lock = 24 LazyInstance<Lock>::Leaky g_static_lock = LAZY_INSTANCE_INITIALIZER;
25 LAZY_INSTANCE_INITIALIZER;
26 25
27 // When did we last alarm and get stuck (for a while) in a debugger? 26 // When did we last alarm and get stuck (for a while) in a debugger?
28 TimeTicks g_last_debugged_alarm_time; 27 TimeTicks g_last_debugged_alarm_time;
29 28
30 // How long did we sit on a break in the debugger? 29 // How long did we sit on a break in the debugger?
31 TimeDelta g_last_debugged_alarm_delay; 30 TimeDelta g_last_debugged_alarm_delay;
32 31
33 } // namespace 32 } // namespace
34 33
35 // Start thread running in a Disarmed state. 34 // Start thread running in a Disarmed state.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 169 }
171 170
172 // static 171 // static
173 void Watchdog::ResetStaticData() { 172 void Watchdog::ResetStaticData() {
174 AutoLock lock(*g_static_lock.Pointer()); 173 AutoLock lock(*g_static_lock.Pointer());
175 g_last_debugged_alarm_time = TimeTicks(); 174 g_last_debugged_alarm_time = TimeTicks();
176 g_last_debugged_alarm_delay = TimeDelta(); 175 g_last_debugged_alarm_delay = TimeDelta();
177 } 176 }
178 177
179 } // namespace base 178 } // namespace base
OLDNEW
« no previous file with comments | « base/nix/mime_util_xdg.cc ('k') | base/tracked_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698