Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h

Issue 2106863003: Handle cross-thread weak persistents during global weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only treat cross-thread weaks during global weak processing Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698