OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void startRepeating(double repeatInterval, const WebTraceLocation& caller) { | 56 void startRepeating(double repeatInterval, const WebTraceLocation& caller) { |
57 start(repeatInterval, repeatInterval, caller); | 57 start(repeatInterval, repeatInterval, caller); |
58 } | 58 } |
59 void startOneShot(double interval, const WebTraceLocation& caller) { | 59 void startOneShot(double interval, const WebTraceLocation& caller) { |
60 start(interval, 0, caller); | 60 start(interval, 0, caller); |
61 } | 61 } |
62 | 62 |
63 // Timer cancellation is fast enough that you shouldn't have to worry | 63 // Timer cancellation is fast enough that you shouldn't have to worry |
64 // about it unless you're canceling tens of thousands of tasks. | 64 // about it unless you're canceling tens of thousands of tasks. |
65 void stop(); | 65 virtual void stop(); |
66 bool isActive() const; | 66 bool isActive() const; |
67 const WebTraceLocation& location() const { return m_location; } | 67 const WebTraceLocation& location() const { return m_location; } |
68 | 68 |
69 double nextFireInterval() const; | 69 double nextFireInterval() const; |
70 double repeatInterval() const { return m_repeatInterval; } | 70 double repeatInterval() const { return m_repeatInterval; } |
71 | 71 |
72 void augmentRepeatInterval(double delta) { | 72 void augmentRepeatInterval(double delta) { |
73 double now = timerMonotonicallyIncreasingTime(); | 73 double now = timerMonotonicallyIncreasingTime(); |
74 setNextFireTime(now, std::max(m_nextFireTime - now + delta, 0.0)); | 74 setNextFireTime(now, std::max(m_nextFireTime - now + delta, 0.0)); |
75 m_repeatInterval += delta; | 75 m_repeatInterval += delta; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 NO_SANITIZE_ADDRESS | 197 NO_SANITIZE_ADDRESS |
198 inline bool TimerBase::isActive() const { | 198 inline bool TimerBase::isActive() const { |
199 ASSERT(m_thread == currentThread()); | 199 ASSERT(m_thread == currentThread()); |
200 return m_weakPtrFactory.hasWeakPtrs(); | 200 return m_weakPtrFactory.hasWeakPtrs(); |
201 } | 201 } |
202 | 202 |
203 } // namespace blink | 203 } // namespace blink |
204 | 204 |
205 #endif // Timer_h | 205 #endif // Timer_h |
OLD | NEW |