| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MarkingVisitorImpl_h | 5 #ifndef MarkingVisitorImpl_h |
| 6 #define MarkingVisitorImpl_h | 6 #define MarkingVisitorImpl_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/ThreadState.h" | 9 #include "platform/heap/ThreadState.h" |
| 10 #include "platform/heap/Visitor.h" | 10 #include "platform/heap/Visitor.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Inline what the above markNoTracing() call expands to, | 97 // Inline what the above markNoTracing() call expands to, |
| 98 // so as to make sure that we do get all the benefits. | 98 // so as to make sure that we do get all the benefits. |
| 99 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); | 99 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); |
| 100 if (header->isMarked()) | 100 if (header->isMarked()) |
| 101 return false; | 101 return false; |
| 102 header->mark(); | 102 header->mark(); |
| 103 #endif | 103 #endif |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 Derived* toDerived() | |
| 108 { | |
| 109 return static_cast<Derived*>(this); | |
| 110 } | |
| 111 | |
| 112 protected: | |
| 113 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback) | 107 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback) |
| 114 { | 108 { |
| 115 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); | 109 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); |
| 116 // We don't want to run weak processings when taking a snapshot. | 110 // We don't want to run weak processings when taking a snapshot. |
| 117 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking) | 111 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking) |
| 118 return; | 112 return; |
| 119 toDerived()->heap().pushGlobalWeakCallback(cell, callback); | 113 toDerived()->heap().pushGlobalWeakCallback(cell, callback); |
| 120 } | 114 } |
| 121 | 115 |
| 116 Derived* toDerived() |
| 117 { |
| 118 return static_cast<Derived*>(this); |
| 119 } |
| 120 |
| 122 private: | 121 private: |
| 123 static void markNoTracingCallback(Visitor* visitor, void* object) | 122 static void markNoTracingCallback(Visitor* visitor, void* object) |
| 124 { | 123 { |
| 125 visitor->markNoTracing(object); | 124 visitor->markNoTracing(object); |
| 126 } | 125 } |
| 127 }; | 126 }; |
| 128 | 127 |
| 129 } // namespace blink | 128 } // namespace blink |
| 130 | 129 |
| 131 #endif | 130 #endif |
| OLD | NEW |