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

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeRareData.h

Issue 2748103002: [wrapper-tracing] Redesign dispatching on non-inheriting cases (Closed)
Patch Set: Addressed comment Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void removeRegistration(MutationObserverRegistration* registration) { 67 void removeRegistration(MutationObserverRegistration* registration) {
68 DCHECK(m_registry.contains(registration)); 68 DCHECK(m_registry.contains(registration));
69 m_registry.remove(m_registry.find(registration)); 69 m_registry.remove(m_registry.find(registration));
70 } 70 }
71 71
72 DEFINE_INLINE_TRACE() { 72 DEFINE_INLINE_TRACE() {
73 visitor->trace(m_registry); 73 visitor->trace(m_registry);
74 visitor->trace(m_transientRegistry); 74 visitor->trace(m_transientRegistry);
75 } 75 }
76 76
77 DECLARE_TRACE_WRAPPERS_WITHOUT_BASE() { 77 DEFINE_INLINE_TRACE_WRAPPERS() {
78 for (auto registration : m_registry) { 78 for (auto registration : m_registry) {
79 visitor->traceWrappers(registration); 79 visitor->traceWrappers(registration);
80 } 80 }
81 for (auto registration : m_transientRegistry) { 81 for (auto registration : m_transientRegistry) {
82 visitor->traceWrappers(registration); 82 visitor->traceWrappers(registration);
83 } 83 }
84 } 84 }
85 85
86 private: 86 private:
87 NodeMutationObserverData() {} 87 NodeMutationObserverData() {}
88 88
89 HeapVector<TraceWrapperMember<MutationObserverRegistration>> m_registry; 89 HeapVector<TraceWrapperMember<MutationObserverRegistration>> m_registry;
90 HeapHashSet<TraceWrapperMember<MutationObserverRegistration>> 90 HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>
91 m_transientRegistry; 91 m_transientRegistry;
92 }; 92 };
93 93
94 DEFINE_TRAIT_FOR_TRACE_WRAPPERS(NodeMutationObserverData);
95
94 class NodeRareData : public GarbageCollectedFinalized<NodeRareData>, 96 class NodeRareData : public GarbageCollectedFinalized<NodeRareData>,
95 public NodeRareDataBase { 97 public NodeRareDataBase {
96 WTF_MAKE_NONCOPYABLE(NodeRareData); 98 WTF_MAKE_NONCOPYABLE(NodeRareData);
97 99
98 public: 100 public:
99 static NodeRareData* create(LayoutObject* layoutObject) { 101 static NodeRareData* create(LayoutObject* layoutObject) {
100 return new NodeRareData(layoutObject); 102 return new NodeRareData(layoutObject);
101 } 103 }
102 104
103 void clearNodeLists() { m_nodeLists.clear(); } 105 void clearNodeLists() { m_nodeLists.clear(); }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 152
151 enum { 153 enum {
152 ConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames. 154 ConnectedFrameCountBits = 10, // Must fit Page::maxNumberOfFrames.
153 }; 155 };
154 156
155 DECLARE_TRACE(); 157 DECLARE_TRACE();
156 158
157 DECLARE_TRACE_AFTER_DISPATCH(); 159 DECLARE_TRACE_AFTER_DISPATCH();
158 void finalizeGarbageCollectedObject(); 160 void finalizeGarbageCollectedObject();
159 161
160 DECLARE_TRACE_WRAPPERS_WITHOUT_BASE(); 162 DECLARE_TRACE_WRAPPERS();
161 DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH(); 163 DECLARE_TRACE_WRAPPERS_AFTER_DISPATCH();
162 164
163 protected: 165 protected:
164 explicit NodeRareData(LayoutObject* layoutObject) 166 explicit NodeRareData(LayoutObject* layoutObject)
165 : NodeRareDataBase(layoutObject), 167 : NodeRareDataBase(layoutObject),
166 m_connectedFrameCount(0), 168 m_connectedFrameCount(0),
167 m_elementFlags(0), 169 m_elementFlags(0),
168 m_restyleFlags(0), 170 m_restyleFlags(0),
169 m_isElementRareData(false) {} 171 m_isElementRareData(false) {}
170 172
171 private: 173 private:
172 Member<NodeListsNodeData> m_nodeLists; 174 Member<NodeListsNodeData> m_nodeLists;
173 Member<NodeMutationObserverData> m_mutationObserverData; 175 Member<NodeMutationObserverData> m_mutationObserverData;
174 176
175 unsigned m_connectedFrameCount : ConnectedFrameCountBits; 177 unsigned m_connectedFrameCount : ConnectedFrameCountBits;
176 unsigned m_elementFlags : NumberOfElementFlags; 178 unsigned m_elementFlags : NumberOfElementFlags;
177 unsigned m_restyleFlags : NumberOfDynamicRestyleFlags; 179 unsigned m_restyleFlags : NumberOfDynamicRestyleFlags;
178 180
179 protected: 181 protected:
180 unsigned m_isElementRareData : 1; 182 unsigned m_isElementRareData : 1;
181 }; 183 };
182 184
185 DEFINE_TRAIT_FOR_TRACE_WRAPPERS(NodeRareData);
186
183 } // namespace blink 187 } // namespace blink
184 188
185 #endif // NodeRareData_h 189 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/NodeListsNodeData.h ('k') | third_party/WebKit/Source/platform/heap/GarbageCollected.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698