Chromium Code Reviews| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 template<typename T> | 110 template<typename T> |
| 111 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) | 111 static inline bool isHeapObjectAlive(const UntracedMember<T>& member) |
| 112 { | 112 { |
| 113 return isHeapObjectAlive(member.get()); | 113 return isHeapObjectAlive(member.get()); |
| 114 } | 114 } |
| 115 template<typename T> | 115 template<typename T> |
| 116 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) | 116 static inline bool isHeapObjectAlive(const RawPtr<T>& ptr) |
| 117 { | 117 { |
| 118 return isHeapObjectAlive(ptr.get()); | 118 return isHeapObjectAlive(ptr.get()); |
| 119 } | 119 } |
| 120 template<typename T> | |
| 121 static inline bool isHeapObjectAlive(const WeakPtr<T>& ptr) | |
|
sof
2016/01/16 14:26:12
Do we really want this?
| |
| 122 { | |
| 123 return isHeapObjectAlive(ptr.get()); | |
| 124 } | |
| 120 | 125 |
| 121 // Is the finalizable GC object still alive, but slated for lazy sweeping? | 126 // Is the finalizable GC object still alive, but slated for lazy sweeping? |
| 122 // If a lazy sweep is in progress, returns true if the object was found | 127 // If a lazy sweep is in progress, returns true if the object was found |
| 123 // to be not reachable during the marking phase, but it has yet to be swept | 128 // to be not reachable during the marking phase, but it has yet to be swept |
| 124 // and finalized. The predicate returns false in all other cases. | 129 // and finalized. The predicate returns false in all other cases. |
| 125 // | 130 // |
| 126 // Holding a reference to an already-dead object is not a valid state | 131 // Holding a reference to an already-dead object is not a valid state |
| 127 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 132 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
| 128 // such a reference. | 133 // such a reference. |
| 129 template<typename T> | 134 template<typename T> |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 493 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
| 489 { | 494 { |
| 490 T** cell = reinterpret_cast<T**>(object); | 495 T** cell = reinterpret_cast<T**>(object); |
| 491 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 496 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 492 *cell = nullptr; | 497 *cell = nullptr; |
| 493 } | 498 } |
| 494 | 499 |
| 495 } // namespace blink | 500 } // namespace blink |
| 496 | 501 |
| 497 #endif // Heap_h | 502 #endif // Heap_h |
| OLD | NEW |