| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 class Timer : public TimerBase { | 148 class Timer : public TimerBase { |
| 149 public: | 149 public: |
| 150 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); | 150 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); |
| 151 | 151 |
| 152 Timer(TimerFiredClass* o, TimerFiredFunction f) | 152 Timer(TimerFiredClass* o, TimerFiredFunction f) |
| 153 : m_object(o), m_function(f) | 153 : m_object(o), m_function(f) |
| 154 { | 154 { |
| 155 } | 155 } |
| 156 | 156 |
| 157 protected: | 157 protected: |
| 158 virtual void fired() override | 158 void fired() override |
| 159 { | 159 { |
| 160 (m_object->*m_function)(this); | 160 (m_object->*m_function)(this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 163 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 164 virtual bool canFire() const override | 164 bool canFire() const override |
| 165 { | 165 { |
| 166 // Oilpan: if a timer fires while Oilpan heaps are being lazily | 166 // Oilpan: if a timer fires while Oilpan heaps are being lazily |
| 167 // swept, it is not safe to proceed if the object is about to | 167 // swept, it is not safe to proceed if the object is about to |
| 168 // be swept (and this timer will be stopped while doing so.) | 168 // be swept (and this timer will be stopped while doing so.) |
| 169 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_obj
ect); | 169 return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_obj
ect); |
| 170 } | 170 } |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should
be traced. | 173 // FIXME: Oilpan: TimerBase should be moved to the heap and m_object should
be traced. |
| 174 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case | 174 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha
t's the case |
| 175 // in the current code base). | 175 // in the current code base). |
| 176 GC_PLUGIN_IGNORE("363031") | 176 GC_PLUGIN_IGNORE("363031") |
| 177 TimerFiredClass* m_object; | 177 TimerFiredClass* m_object; |
| 178 TimerFiredFunction m_function; | 178 TimerFiredFunction m_function; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 181 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 182 inline bool TimerBase::isActive() const | 182 inline bool TimerBase::isActive() const |
| 183 { | 183 { |
| 184 ASSERT(m_thread == currentThread()); | 184 ASSERT(m_thread == currentThread()); |
| 185 return m_cancellableTimerTask; | 185 return m_cancellableTimerTask; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| 189 | 189 |
| 190 #endif // Timer_h | 190 #endif // Timer_h |
| OLD | NEW |