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

Side by Side Diff: third_party/WebKit/Source/platform/Timer.h

Issue 2267373004: Add a comment to caution that timer::stop() should not be called too much (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 void startRepeating(double repeatInterval, const WebTraceLocation& caller) 52 void startRepeating(double repeatInterval, const WebTraceLocation& caller)
53 { 53 {
54 start(repeatInterval, repeatInterval, caller); 54 start(repeatInterval, repeatInterval, caller);
55 } 55 }
56 void startOneShot(double interval, const WebTraceLocation& caller) 56 void startOneShot(double interval, const WebTraceLocation& caller)
57 { 57 {
58 start(interval, 0, caller); 58 start(interval, 0, caller);
59 } 59 }
60 60
61 // Timer cancellation is supported but not free. Please be careful not to
62 // cause a flood of timer cancellations.
61 void stop(); 63 void stop();
62 bool isActive() const; 64 bool isActive() const;
63 const WebTraceLocation& location() const { return m_location; } 65 const WebTraceLocation& location() const { return m_location; }
64 66
65 double nextFireInterval() const; 67 double nextFireInterval() const;
66 double repeatInterval() const { return m_repeatInterval; } 68 double repeatInterval() const { return m_repeatInterval; }
67 69
68 void augmentRepeatInterval(double delta) { 70 void augmentRepeatInterval(double delta) {
69 double now = timerMonotonicallyIncreasingTime(); 71 double now = timerMonotonicallyIncreasingTime();
70 setNextFireTime(now, std::max(m_nextFireTime - now + delta, 0.0)); 72 setNextFireTime(now, std::max(m_nextFireTime - now + delta, 0.0));
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 NO_LAZY_SWEEP_SANITIZE_ADDRESS 226 NO_LAZY_SWEEP_SANITIZE_ADDRESS
225 inline bool TimerBase::isActive() const 227 inline bool TimerBase::isActive() const
226 { 228 {
227 ASSERT(m_thread == currentThread()); 229 ASSERT(m_thread == currentThread());
228 return m_cancellableTimerTask; 230 return m_cancellableTimerTask;
229 } 231 }
230 232
231 } // namespace blink 233 } // namespace blink
232 234
233 #endif // Timer_h 235 #endif // Timer_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698