OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // callback for each cell that needs to be zeroed, so if you have a lot of | 201 // callback for each cell that needs to be zeroed, so if you have a lot of |
202 // weak cells in your object you should still consider using | 202 // weak cells in your object you should still consider using |
203 // registerWeakMembers above. | 203 // registerWeakMembers above. |
204 // | 204 // |
205 // In contrast to registerWeakMembers, the weak cell callbacks are | 205 // In contrast to registerWeakMembers, the weak cell callbacks are |
206 // run on the thread performing garbage collection. Therefore, all | 206 // run on the thread performing garbage collection. Therefore, all |
207 // threads are stopped during weak cell callbacks. | 207 // threads are stopped during weak cell callbacks. |
208 template<typename T> | 208 template<typename T> |
209 void registerWeakCell(T** cell) | 209 void registerWeakCell(T** cell) |
210 { | 210 { |
211 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast
<void**>(cell), &handleWeakCell<T>); | 211 Derived::fromHelper(this)->registerWeakCellWithCallback(reinterpret_cast
<void**>(const_cast<typename std::remove_const<T>::type**>(cell)), &handleWeakCe
ll<T>); |
212 } | 212 } |
213 | 213 |
214 template<typename T, void (T::*method)(Visitor*)> | 214 template<typename T, void (T::*method)(Visitor*)> |
215 void registerWeakMembers(const T* obj) | 215 void registerWeakMembers(const T* obj) |
216 { | 216 { |
217 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); | 217 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); |
218 } | 218 } |
219 void registerWeakMembers(const void* object, WeakCallback callback) | 219 void registerWeakMembers(const void* object, WeakCallback callback) |
220 { | 220 { |
221 Derived::fromHelper(this)->registerWeakMembers(object, object, callback)
; | 221 Derived::fromHelper(this)->registerWeakMembers(object, object, callback)
; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 private: | 323 private: |
324 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } | 324 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } |
325 | 325 |
326 ThreadState* m_state; | 326 ThreadState* m_state; |
327 const MarkingMode m_markingMode; | 327 const MarkingMode m_markingMode; |
328 }; | 328 }; |
329 | 329 |
330 } // namespace blink | 330 } // namespace blink |
331 | 331 |
332 #endif // Visitor_h | 332 #endif // Visitor_h |
OLD | NEW |