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

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

Issue 2625363002: Simplify visitor marking mode tracking. (Closed)
Patch Set: HeapTest compilation fix Created 3 years, 11 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 InlinedGlobalMarkingVisitor_h 5 #ifndef InlinedGlobalMarkingVisitor_h
6 #define InlinedGlobalMarkingVisitor_h 6 #define InlinedGlobalMarkingVisitor_h
7 7
8 #include "platform/heap/MarkingVisitorImpl.h" 8 #include "platform/heap/MarkingVisitorImpl.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class InlinedGlobalMarkingVisitor final 12 class InlinedGlobalMarkingVisitor final
13 : public VisitorHelper<InlinedGlobalMarkingVisitor>, 13 : public VisitorHelper<InlinedGlobalMarkingVisitor>,
14 public MarkingVisitorImpl<InlinedGlobalMarkingVisitor> { 14 public MarkingVisitorImpl<InlinedGlobalMarkingVisitor> {
15 public: 15 public:
16 friend class VisitorHelper<InlinedGlobalMarkingVisitor>; 16 friend class VisitorHelper<InlinedGlobalMarkingVisitor>;
17 using Helper = VisitorHelper<InlinedGlobalMarkingVisitor>; 17 using Helper = VisitorHelper<InlinedGlobalMarkingVisitor>;
18 friend class MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; 18 friend class MarkingVisitorImpl<InlinedGlobalMarkingVisitor>;
19 using Impl = MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; 19 using Impl = MarkingVisitorImpl<InlinedGlobalMarkingVisitor>;
20 20
21 InlinedGlobalMarkingVisitor(ThreadState* state, 21 InlinedGlobalMarkingVisitor(ThreadState* state,
22 Visitor::MarkingMode markingMode) 22 VisitorMarkingMode markingMode)
23 : VisitorHelper(state), m_markingMode(markingMode) {} 23 : VisitorHelper(state, markingMode) {}
24 24
25 // Hack to unify interface to visitor->trace(). 25 // Hack to unify interface to visitor->trace().
26 // Without this hack, we need to use visitor.trace() for 26 // Without this hack, we need to use visitor.trace() for
27 // trace(InlinedGlobalMarkingVisitor) and visitor->trace() for 27 // trace(InlinedGlobalMarkingVisitor) and visitor->trace() for
28 // trace(Visitor*). 28 // trace(Visitor*).
29 InlinedGlobalMarkingVisitor* operator->() { return this; } 29 InlinedGlobalMarkingVisitor* operator->() { return this; }
30 30
31 using Impl::mark; 31 using Impl::mark;
32 using Impl::ensureMarked; 32 using Impl::ensureMarked;
33 using Impl::registerDelayedMarkNoTracing; 33 using Impl::registerDelayedMarkNoTracing;
34 using Impl::registerWeakTable; 34 using Impl::registerWeakTable;
35 using Impl::registerWeakMembers; 35 using Impl::registerWeakMembers;
36 #if ENABLE(ASSERT) 36 #if ENABLE(ASSERT)
37 using Impl::weakTableRegistered; 37 using Impl::weakTableRegistered;
38 #endif 38 #endif
39 39
40 template <typename T> 40 template <typename T>
41 void mark(T* t) { 41 void mark(T* t) {
42 Helper::mark(t); 42 Helper::mark(t);
43 } 43 }
44 44
45 template <typename T, void (T::*method)(Visitor*)> 45 template <typename T, void (T::*method)(Visitor*)>
46 void registerWeakMembers(const T* obj) { 46 void registerWeakMembers(const T* obj) {
47 Helper::template registerWeakMembers<T, method>(obj); 47 Helper::template registerWeakMembers<T, method>(obj);
48 } 48 }
49 49
50 protected:
51 // Methods to be called from MarkingVisitorImpl.
52
53 inline Visitor::MarkingMode getMarkingMode() const { return m_markingMode; }
54
55 private: 50 private:
56 static InlinedGlobalMarkingVisitor fromHelper(Helper* helper) { 51 static InlinedGlobalMarkingVisitor fromHelper(Helper* helper) {
57 return *static_cast<InlinedGlobalMarkingVisitor*>(helper); 52 return *static_cast<InlinedGlobalMarkingVisitor*>(helper);
58 } 53 }
59
60 // TODO(sof): attempt to unify this field with Visitor::m_markingMode.
61 const Visitor::MarkingMode m_markingMode;
62 }; 54 };
63 55
64 inline void GarbageCollectedMixin::trace(InlinedGlobalMarkingVisitor) {} 56 inline void GarbageCollectedMixin::trace(InlinedGlobalMarkingVisitor) {}
65 57
66 } // namespace blink 58 } // namespace blink
67 59
68 #endif 60 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | third_party/WebKit/Source/platform/heap/MarkingVisitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698