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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
(...skipping 25 matching lines...) Expand all Loading... |
161 m_shouldRestartWhenTimerFires = true; | 161 m_shouldRestartWhenTimerFires = true; |
162 return; | 162 return; |
163 } | 163 } |
164 startOneShot(m_delay, caller); | 164 startOneShot(m_delay, caller); |
165 } | 165 } |
166 | 166 |
167 using TimerBase::stop; | 167 using TimerBase::stop; |
168 using TimerBase::isActive; | 168 using TimerBase::isActive; |
169 | 169 |
170 private: | 170 private: |
171 virtual void fired() OVERRIDE | 171 virtual void fired() override |
172 { | 172 { |
173 if (m_shouldRestartWhenTimerFires) { | 173 if (m_shouldRestartWhenTimerFires) { |
174 m_shouldRestartWhenTimerFires = false; | 174 m_shouldRestartWhenTimerFires = false; |
175 // FIXME: This should not be FROM_HERE. | 175 // FIXME: This should not be FROM_HERE. |
176 startOneShot(m_delay, FROM_HERE); | 176 startOneShot(m_delay, FROM_HERE); |
177 return; | 177 return; |
178 } | 178 } |
179 | 179 |
180 (m_object->*m_function)(this); | 180 (m_object->*m_function)(this); |
181 } | 181 } |
182 | 182 |
183 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. | 183 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. |
184 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case | 184 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case |
185 // in the current code base). | 185 // in the current code base). |
186 GC_PLUGIN_IGNORE("363031") | 186 GC_PLUGIN_IGNORE("363031") |
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 |