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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #if ENABLE(ASSERT) | 107 #if ENABLE(ASSERT) |
108 ThreadIdentifier m_thread; | 108 ThreadIdentifier m_thread; |
109 #endif | 109 #endif |
110 | 110 |
111 friend class ThreadTimers; | 111 friend class ThreadTimers; |
112 friend class TimerHeapLessThanFunction; | 112 friend class TimerHeapLessThanFunction; |
113 friend class TimerHeapReference; | 113 friend class TimerHeapReference; |
114 }; | 114 }; |
115 | 115 |
116 template <typename TimerFiredClass> | 116 template <typename TimerFiredClass> |
117 class Timer FINAL : public TimerBase { | 117 class Timer final : public TimerBase { |
118 public: | 118 public: |
119 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); | 119 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); |
120 | 120 |
121 Timer(TimerFiredClass* o, TimerFiredFunction f) | 121 Timer(TimerFiredClass* o, TimerFiredFunction f) |
122 : m_object(o), m_function(f) { } | 122 : m_object(o), m_function(f) { } |
123 | 123 |
124 private: | 124 private: |
125 virtual void fired() override { (m_object->*m_function)(this); } | 125 virtual void fired() override { (m_object->*m_function)(this); } |
126 | 126 |
127 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. | 127 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. |
128 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case | 128 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case |
129 // in the current code base). | 129 // in the current code base). |
130 GC_PLUGIN_IGNORE("363031") | 130 GC_PLUGIN_IGNORE("363031") |
131 TimerFiredClass* m_object; | 131 TimerFiredClass* m_object; |
132 TimerFiredFunction m_function; | 132 TimerFiredFunction m_function; |
133 }; | 133 }; |
134 | 134 |
135 inline bool TimerBase::isActive() const | 135 inline bool TimerBase::isActive() const |
136 { | 136 { |
137 ASSERT(m_thread == currentThread()); | 137 ASSERT(m_thread == currentThread()); |
138 return m_nextFireTime; | 138 return m_nextFireTime; |
139 } | 139 } |
140 | 140 |
141 template <typename TimerFiredClass> | 141 template <typename TimerFiredClass> |
142 class DeferrableOneShotTimer FINAL : private TimerBase { | 142 class DeferrableOneShotTimer final : private TimerBase { |
143 public: | 143 public: |
144 typedef void (TimerFiredClass::*TimerFiredFunction)(DeferrableOneShotTimer*)
; | 144 typedef void (TimerFiredClass::*TimerFiredFunction)(DeferrableOneShotTimer*)
; |
145 | 145 |
146 DeferrableOneShotTimer(TimerFiredClass* o, TimerFiredFunction f, double dela
y) | 146 DeferrableOneShotTimer(TimerFiredClass* o, TimerFiredFunction f, double dela
y) |
147 : m_object(o) | 147 : m_object(o) |
148 , m_function(f) | 148 , m_function(f) |
149 , m_delay(delay) | 149 , m_delay(delay) |
150 , m_shouldRestartWhenTimerFires(false) | 150 , m_shouldRestartWhenTimerFires(false) |
151 { | 151 { |
152 } | 152 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 TimerFiredClass* m_object; | 187 TimerFiredClass* m_object; |
188 TimerFiredFunction m_function; | 188 TimerFiredFunction m_function; |
189 | 189 |
190 double m_delay; | 190 double m_delay; |
191 bool m_shouldRestartWhenTimerFires; | 191 bool m_shouldRestartWhenTimerFires; |
192 }; | 192 }; |
193 | 193 |
194 } | 194 } |
195 | 195 |
196 #endif | 196 #endif |
OLD | NEW |