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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 120 }; |
121 | 121 |
122 template<typename T> | 122 template<typename T> |
123 class TimerIsObjectAliveTrait<T, true> { | 123 class TimerIsObjectAliveTrait<T, true> { |
124 public: | 124 public: |
125 static bool isAlive(T* objectPointer) | 125 static bool isAlive(T* objectPointer) |
126 { | 126 { |
127 // Oilpan: if a timer fires while Oilpan heaps are being lazily | 127 // Oilpan: if a timer fires while Oilpan heaps are being lazily |
128 // swept, it is not safe to proceed if the object is about to | 128 // swept, it is not safe to proceed if the object is about to |
129 // be swept (and this timer will be stopped while doing so.) | 129 // be swept (and this timer will be stopped while doing so.) |
130 return Heap::isFinalizedObjectAlive(objectPointer); | 130 return !Heap::willObjectBeLazilySwept(objectPointer); |
131 } | 131 } |
132 }; | 132 }; |
133 | 133 |
134 template <typename TimerFiredClass> | 134 template <typename TimerFiredClass> |
135 class Timer final : public TimerBase { | 135 class Timer final : public TimerBase { |
136 public: | 136 public: |
137 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); | 137 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); |
138 | 138 |
139 Timer(TimerFiredClass* o, TimerFiredFunction f) | 139 Timer(TimerFiredClass* o, TimerFiredFunction f) |
140 : m_object(o), m_function(f) { } | 140 : m_object(o), m_function(f) { } |
(...skipping 16 matching lines...) Expand all Loading... |
157 | 157 |
158 inline bool TimerBase::isActive() const | 158 inline bool TimerBase::isActive() const |
159 { | 159 { |
160 ASSERT(m_thread == currentThread()); | 160 ASSERT(m_thread == currentThread()); |
161 return m_nextFireTime; | 161 return m_nextFireTime; |
162 } | 162 } |
163 | 163 |
164 } | 164 } |
165 | 165 |
166 #endif | 166 #endif |
OLD | NEW |