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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 // collection has been strongified, there is no way that it can contain | 241 // collection has been strongified, there is no way that it can contain |
| 242 // non-live entries, so no entries will be removed. Since you can't set | 242 // non-live entries, so no entries will be removed. Since you can't set |
| 243 // the mark bit on a null pointer, that means that null pointers are | 243 // the mark bit on a null pointer, that means that null pointers are |
| 244 // always 'alive'. | 244 // always 'alive'. |
| 245 if (!object) | 245 if (!object) |
| 246 return true; | 246 return true; |
| 247 // TODO(keishi): some tests create CrossThreadPersistent on non attached | 247 // TODO(keishi): some tests create CrossThreadPersistent on non attached |
| 248 // threads. | 248 // threads. |
| 249 if (!ThreadState::current()) | 249 if (!ThreadState::current()) |
| 250 return true; | 250 return true; |
| 251 if (&ThreadState::current()->heap() != | 251 DCHECK(&ThreadState::current()->heap() == |
|
sof
2017/03/28 19:50:09
How does this work for CrossThreadWeakPersistent<>
sof
2017/03/28 20:02:07
The shouldTracePersistentNode() same-heap check sh
| |
| 252 &pageFromObject(object)->arena()->getThreadState()->heap()) | 252 &pageFromObject(object)->arena()->getThreadState()->heap()); |
| 253 return true; | |
| 254 return ObjectAliveTrait<T>::isHeapObjectAlive(object); | 253 return ObjectAliveTrait<T>::isHeapObjectAlive(object); |
| 255 } | 254 } |
| 256 template <typename T> | 255 template <typename T> |
| 257 static inline bool isHeapObjectAlive(const Member<T>& member) { | 256 static inline bool isHeapObjectAlive(const Member<T>& member) { |
| 258 return isHeapObjectAlive(member.get()); | 257 return isHeapObjectAlive(member.get()); |
| 259 } | 258 } |
| 260 template <typename T> | 259 template <typename T> |
| 261 static inline bool isHeapObjectAlive(const WeakMember<T>& member) { | 260 static inline bool isHeapObjectAlive(const WeakMember<T>& member) { |
| 262 return isHeapObjectAlive(member.get()); | 261 return isHeapObjectAlive(member.get()); |
| 263 } | 262 } |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 T** cell = reinterpret_cast<T**>(object); | 660 T** cell = reinterpret_cast<T**>(object); |
| 662 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 661 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 663 *cell = nullptr; | 662 *cell = nullptr; |
| 664 } | 663 } |
| 665 | 664 |
| 666 } // namespace blink | 665 } // namespace blink |
| 667 | 666 |
| 668 #include "platform/heap/VisitorImpl.h" | 667 #include "platform/heap/VisitorImpl.h" |
| 669 | 668 |
| 670 #endif // Heap_h | 669 #endif // Heap_h |
| OLD | NEW |