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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 template <typename TimerFiredClass> | 137 template <typename TimerFiredClass> |
138 class Timer : public TimerBase { | 138 class Timer : public TimerBase { |
139 public: | 139 public: |
140 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); | 140 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); |
141 | 141 |
142 Timer(TimerFiredClass* o, TimerFiredFunction f) | 142 Timer(TimerFiredClass* o, TimerFiredFunction f) |
143 : m_object(o), m_function(f) { } | 143 : m_object(o), m_function(f) { } |
144 | 144 |
145 protected: | 145 protected: |
| 146 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
146 virtual void fired() override | 147 virtual void fired() override |
147 { | 148 { |
148 if (!TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_objec
t)) | 149 if (!TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_objec
t)) |
149 return; | 150 return; |
150 (m_object->*m_function)(this); | 151 (m_object->*m_function)(this); |
151 } | 152 } |
152 | 153 |
153 private: | 154 private: |
154 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. | 155 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should
be traced. |
155 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case | 156 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case |
156 // in the current code base). | 157 // in the current code base). |
157 GC_PLUGIN_IGNORE("363031") | 158 GC_PLUGIN_IGNORE("363031") |
158 TimerFiredClass* m_object; | 159 TimerFiredClass* m_object; |
159 TimerFiredFunction m_function; | 160 TimerFiredFunction m_function; |
160 }; | 161 }; |
161 | 162 |
162 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 163 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
163 inline bool TimerBase::isActive() const | 164 inline bool TimerBase::isActive() const |
164 { | 165 { |
165 ASSERT(m_thread == currentThread()); | 166 ASSERT(m_thread == currentThread()); |
166 return m_nextFireTime; | 167 return m_nextFireTime; |
167 } | 168 } |
168 | 169 |
169 } | 170 } |
170 | 171 |
171 #endif | 172 #endif |
OLD | NEW |