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

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

Issue 2872133004: blink style: Update one class cluster, delete one class, change comment style. (Closed)
Patch Set: fun Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/testing/PaintPrinters.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 WrapperVisitor_h 5 #ifndef WrapperVisitor_h
6 #define WrapperVisitor_h 6 #define WrapperVisitor_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/wtf/Allocator.h" 9 #include "platform/wtf/Allocator.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 class Value; 12 class Value;
13 template <class T> 13 template <class T>
14 class PersistentBase; 14 class PersistentBase;
15 } 15 }
16 16
17 namespace blink { 17 namespace blink {
18 18
19 template <typename T> 19 template <typename T>
20 class TraceTrait; 20 class TraceTrait;
21 template <typename T> 21 template <typename T>
22 class Member; 22 class Member;
23 class ScriptWrappable; 23 class ScriptWrappable;
24 template <typename T> 24 template <typename T>
25 class TraceWrapperV8Reference; 25 class TraceWrapperV8Reference;
26 class TraceWrapperBase; 26 class TraceWrapperBase;
27 template <typename T> 27 template <typename T>
28 class TraceWrapperMember; 28 class TraceWrapperMember;
29 29
30 /** 30 // Declares non-virtual TraceWrappers method. Should be used on
31 * Declares non-virtual traceWrappers method. Should be used on 31 // non-ScriptWrappable classes which should participate in wrapper tracing (e.g.
32 * non-ScriptWrappable classes which should participate in wrapper tracing (e.g. 32 // StyleEngine):
33 * StyleEngine): 33 //
34 * 34 // class StyleEngine: public TraceWrapperBase {
35 * class StyleEngine: public TraceWrapperBase { 35 // public:
36 * public: 36 // DECLARE_TRACE_WRAPPERS();
37 * DECLARE_TRACE_WRAPPERS(); 37 // };
38 * }; 38 //
39 */
40 #define DECLARE_TRACE_WRAPPERS() \ 39 #define DECLARE_TRACE_WRAPPERS() \
41 void TraceWrappers(const WrapperVisitor* visitor) const 40 void TraceWrappers(const WrapperVisitor* visitor) const
42 41
43 /** 42 // Declares virtual TraceWrappers method. It is used in ScriptWrappable, can be
44 * Declares virtual traceWrappers method. It is used in ScriptWrappable, can be 43 // used to override the method in the subclasses, and can be used by
45 * used to override the method in the subclasses, and can be used by 44 // non-ScriptWrappable classes which expect to be inherited.
46 * non-ScriptWrappable classes which expect to be inherited.
47 */
48 #define DECLARE_VIRTUAL_TRACE_WRAPPERS() virtual DECLARE_TRACE_WRAPPERS() 45 #define DECLARE_VIRTUAL_TRACE_WRAPPERS() virtual DECLARE_TRACE_WRAPPERS()
49 46
50 /** 47 // Provides definition of TraceWrappers method. Custom code will usually call
51 * Provides definition of traceWrappers method. Custom code will usually call 48 // visitor->TraceWrappers with all objects which could contribute to the set of
52 * visitor->traceWrappers with all objects which could contribute to the set of 49 // reachable wrappers:
53 * reachable wrappers: 50 //
54 * 51 // DEFINE_TRACE_WRAPPERS(NodeRareData)
55 * DEFINE_TRACE_WRAPPERS(NodeRareData) 52 // {
56 * { 53 // visitor->TraceWrappers(node_lists_);
57 * visitor->traceWrappers(m_nodeLists); 54 // visitor->TraceWrappers(mutation_observer_data_);
58 * visitor->traceWrappers(m_mutationObserverData); 55 // }
59 * } 56 //
60 */
61 #define DEFINE_TRACE_WRAPPERS(T) \ 57 #define DEFINE_TRACE_WRAPPERS(T) \
62 void T::TraceWrappers(const WrapperVisitor* visitor) const 58 void T::TraceWrappers(const WrapperVisitor* visitor) const
63 59
64 #define DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH() \ 60 #define DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH() \
65 void TraceWrappersAfterDispatch(const WrapperVisitor*) const 61 void TraceWrappersAfterDispatch(const WrapperVisitor*) const
66 62
67 #define DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(T) \ 63 #define DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(T) \
68 void T::TraceWrappersAfterDispatch(const WrapperVisitor* visitor) const 64 void T::TraceWrappersAfterDispatch(const WrapperVisitor* visitor) const
69 65
70 #define DEFINE_INLINE_TRACE_WRAPPERS() DECLARE_TRACE_WRAPPERS() 66 #define DEFINE_INLINE_TRACE_WRAPPERS() DECLARE_TRACE_WRAPPERS()
(...skipping 28 matching lines...) Expand all
99 } 95 }
100 96
101 if (TraceTrait<T>::GetHeapObjectHeader(traceable) 97 if (TraceTrait<T>::GetHeapObjectHeader(traceable)
102 ->IsWrapperHeaderMarked()) { 98 ->IsWrapperHeaderMarked()) {
103 return; 99 return;
104 } 100 }
105 101
106 MarkAndPushToMarkingDeque(traceable); 102 MarkAndPushToMarkingDeque(traceable);
107 } 103 }
108 104
109 /** 105 // Trace all wrappers of |t|.
110 * Trace all wrappers of |t|. 106 //
111 * 107 // If you cannot use TraceWrapperMember & the corresponding TraceWrappers()
112 * If you cannot use TraceWrapperMember & the corresponding traceWrappers() 108 // for some reason (e.g., due to sizeof(TraceWrapperMember)), you can use
113 * for some reason (e.g., due to sizeof(TraceWrapperMember)), you can use 109 // Member and |TraceWrappersWithManualWriteBarrier()|. See below.
114 * Member and |traceWrappersWithManualWriteBarrier()|. See below.
115 */
116 template <typename T> 110 template <typename T>
117 void TraceWrappers(const TraceWrapperMember<T>& t) const { 111 void TraceWrappers(const TraceWrapperMember<T>& t) const {
118 TraceWrappers(t.Get()); 112 TraceWrappers(t.Get());
119 } 113 }
120 114
121 /** 115 // Require all users of manual write barriers to make this explicit in their
122 * Require all users of manual write barriers to make this explicit in their 116 // |TraceWrappers| definition. Be sure to add
123 * |traceWrappers| definition. Be sure to add 117 // |ScriptWrappableVisitor::writeBarrier(this, new_value)| after all
124 * |ScriptWrappableVisitor::writeBarrier(this, new_value)| after all 118 // assignments to the field. Otherwise, the objects may be collected
125 * assignments to the field. Otherwise, the objects may be collected 119 // prematurely.
126 * prematurely.
127 */
128 template <typename T> 120 template <typename T>
129 void TraceWrappersWithManualWriteBarrier(const Member<T>& t) const { 121 void TraceWrappersWithManualWriteBarrier(const Member<T>& t) const {
130 TraceWrappers(t.Get()); 122 TraceWrappers(t.Get());
131 } 123 }
132 template <typename T> 124 template <typename T>
133 void TraceWrappersWithManualWriteBarrier(const WeakMember<T>& t) const { 125 void TraceWrappersWithManualWriteBarrier(const WeakMember<T>& t) const {
134 TraceWrappers(t.Get()); 126 TraceWrappers(t.Get());
135 } 127 }
136 template <typename T> 128 template <typename T>
137 void TraceWrappersWithManualWriteBarrier(const T* traceable) const { 129 void TraceWrappersWithManualWriteBarrier(const T* traceable) const {
(...skipping 30 matching lines...) Expand all
168 virtual bool PushToMarkingDeque( 160 virtual bool PushToMarkingDeque(
169 void (*trace_wrappers_callback)(const WrapperVisitor*, const void*), 161 void (*trace_wrappers_callback)(const WrapperVisitor*, const void*),
170 HeapObjectHeader* (*heap_object_header_callback)(const void*), 162 HeapObjectHeader* (*heap_object_header_callback)(const void*),
171 void (*missed_write_barrier_callback)(void), 163 void (*missed_write_barrier_callback)(void),
172 const void*) const = 0; 164 const void*) const = 0;
173 }; 165 };
174 166
175 } // namespace blink 167 } // namespace blink
176 168
177 #endif // WrapperVisitor_h 169 #endif // WrapperVisitor_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/testing/PaintPrinters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698