| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // HeapHashMap can cause an allocation if the backing store resizes, but | 332 // HeapHashMap can cause an allocation if the backing store resizes, but |
| 333 // these collections know to remove WeakMember elements safely. | 333 // these collections know to remove WeakMember elements safely. |
| 334 // | 334 // |
| 335 // The weak pointer callbacks are run on the thread that owns the | 335 // The weak pointer callbacks are run on the thread that owns the |
| 336 // object and other threads are not stopped during the | 336 // object and other threads are not stopped during the |
| 337 // callbacks. Since isAlive is used in the callback to determine | 337 // callbacks. Since isAlive is used in the callback to determine |
| 338 // if objects pointed to are alive it is crucial that the object | 338 // if objects pointed to are alive it is crucial that the object |
| 339 // pointed to belong to the same thread as the object receiving | 339 // pointed to belong to the same thread as the object receiving |
| 340 // the weak callback. Since other threads have been resumed the | 340 // the weak callback. Since other threads have been resumed the |
| 341 // mark bits are not valid for objects from other threads. | 341 // mark bits are not valid for objects from other threads. |
| 342 virtual void registerWeakMembers(const void*, WeakPointerCallback) = 0; | 342 virtual void registerWeakMembers(const void* object, WeakPointerCallback cal
lback) { registerWeakMembers(object, object, callback); } |
| 343 virtual void registerWeakMembers(const void*, const void*, WeakPointerCallba
ck) = 0; |
| 343 | 344 |
| 344 template<typename T, void (T::*method)(Visitor*)> | 345 template<typename T, void (T::*method)(Visitor*)> |
| 345 void registerWeakMembers(const T* obj) | 346 void registerWeakMembers(const T* obj) |
| 346 { | 347 { |
| 347 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); | 348 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); |
| 348 } | 349 } |
| 349 | 350 |
| 350 // For simple cases where you just want to zero out a cell when the thing | 351 // For simple cases where you just want to zero out a cell when the thing |
| 351 // it is pointing at is garbage, you can use this. This will register a | 352 // it is pointing at is garbage, you can use this. This will register a |
| 352 // callback for each cell that needs to be zeroed, so if you have a lot of | 353 // callback for each cell that needs to be zeroed, so if you have a lot of |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 struct GCInfoTrait { | 657 struct GCInfoTrait { |
| 657 static const GCInfo* get() | 658 static const GCInfo* get() |
| 658 { | 659 { |
| 659 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 660 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
| 660 } | 661 } |
| 661 }; | 662 }; |
| 662 | 663 |
| 663 } | 664 } |
| 664 | 665 |
| 665 #endif | 666 #endif |
| OLD | NEW |