Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/Visitor.h |
| diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h |
| index f93d1e4d52fd9ce3516a7bc9399758f7c60a2343..be6036d156c8f0cbfff68ea7e0581368d69f57be 100644 |
| --- a/third_party/WebKit/Source/platform/heap/Visitor.h |
| +++ b/third_party/WebKit/Source/platform/heap/Visitor.h |
| @@ -243,10 +243,26 @@ class VisitorHelper { |
| void registerWeakMembers(const T* obj) { |
| registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); |
| } |
| + |
| void registerWeakMembers(const void* object, WeakCallback callback) { |
| Derived::fromHelper(this)->registerWeakMembers(object, object, callback); |
| } |
| + template <typename T> |
| + void registerBackingStoreReference(T** slot) { |
| + Derived::fromHelper(this)->registerMovingObjectReference( |
| + reinterpret_cast<MovableReference*>(slot)); |
| + } |
| + |
| + template <typename T> |
| + void registerBackingStoreCallback(T* backingStore, |
| + MovingObjectCallback callback, |
| + void* callbackData) { |
| + Derived::fromHelper(this)->registerMovingObjectCallback( |
| + reinterpret_cast<MovableReference>(backingStore), callback, |
| + callbackData); |
| + } |
| + |
| inline ThreadState* state() const { return m_state; } |
| inline ThreadHeap& heap() const { return state()->heap(); } |
| @@ -284,6 +300,7 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| // This visitor is used to trace objects during weak processing. |
| // This visitor is allowed to trace only already marked objects. |
| WeakProcessing, |
| + GlobalMarkCompacting, |
|
haraken
2016/12/02 12:43:21
Add a comment.
sof
2016/12/04 14:55:38
Done.
|
| }; |
| static std::unique_ptr<Visitor> create(ThreadState*, BlinkGC::GCType); |
| @@ -310,7 +327,10 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| // object. If collection backings are reachable from other |
| // locations we strongify them to avoid issues with iterators and |
| // weak processing. |
| - virtual void registerDelayedMarkNoTracing(const void*) = 0; |
| + // A pointer to the location holding the backing store reference |
| + // is passed in. This is done so as to potentially allow that |
| + // location to be updated by the garbage collector. |
| + virtual void registerDelayedMarkNoTracing(void**) = 0; |
| // If the object calls this during the regular trace callback, then the |
| // WeakCallback argument may be called later, when the strong roots |
| @@ -344,10 +364,23 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| virtual bool ensureMarked(const void*) = 0; |
| + virtual void registerMovingObjectReference(MovableReference*) = 0; |
| + |
| + virtual void registerMovingObjectCallback(MovableReference, |
| + MovingObjectCallback, |
| + void*) = 0; |
| + |
| virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; |
| inline MarkingMode getMarkingMode() const { return m_markingMode; } |
| + inline bool isGlobalMarking() const { |
| + return m_markingMode == GlobalMarking || |
| + m_markingMode == GlobalMarkCompacting; |
| + } |
| + |
| + void setMarkCompactionMode() { m_markingMode = GlobalMarkCompacting; } |
| + |
| protected: |
| Visitor(ThreadState*, MarkingMode); |
| @@ -357,7 +390,7 @@ class PLATFORM_EXPORT Visitor : public VisitorHelper<Visitor> { |
| } |
| ThreadState* m_state; |
|
sof
2016/12/04 14:55:38
I noticed that this field is unused; now removed.
|
| - const MarkingMode m_markingMode; |
| + MarkingMode m_markingMode; |
| }; |
| } // namespace blink |