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

Side by Side Diff: Source/core/dom/ContainerNode.h

Issue 262093006: Oilpan: Make the Node hierarchy RefCountedGarbageCollected instead of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another build fix. Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 // ------------------------------------------------------------------------- ---- 184 // ------------------------------------------------------------------------- ----
185 // Notification of document structure changes (see core/dom/Node.h for more notification methods) 185 // Notification of document structure changes (see core/dom/Node.h for more notification methods)
186 186
187 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child 187 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child
188 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value. 188 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value.
189 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0); 189 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0);
190 190
191 void disconnectDescendantFrames(); 191 void disconnectDescendantFrames();
192 192
193 virtual void trace(Visitor*) OVERRIDE;
194
193 protected: 195 protected:
194 ContainerNode(TreeScope*, ConstructionType = CreateContainer); 196 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
195 197
196 template<class GenericNode, class GenericNodeContainer> 198 template<class GenericNode, class GenericNodeContainer>
197 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer& ); 199 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer& );
198 200
199 template<class GenericNode, class GenericNodeContainer> 201 template<class GenericNode, class GenericNodeContainer>
200 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer&); 202 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi cNode*& tail, GenericNodeContainer&);
201 203
204 #if !ENABLE(OILPAN)
202 void removeDetachedChildren(); 205 void removeDetachedChildren();
206 #endif
207
203 void setFirstChild(Node* child) { m_firstChild = child; } 208 void setFirstChild(Node* child) { m_firstChild = child; }
204 void setLastChild(Node* child) { m_lastChild = child; } 209 void setLastChild(Node* child) { m_lastChild = child; }
205 210
206 private: 211 private:
207 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 212 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
208 void insertBeforeCommon(Node& nextChild, Node& oldChild); 213 void insertBeforeCommon(Node& nextChild, Node& oldChild);
209 void updateTreeAfterInsertion(Node& child); 214 void updateTreeAfterInsertion(Node& child);
210 void willRemoveChildren(); 215 void willRemoveChildren();
211 void willRemoveChild(Node& child); 216 void willRemoveChild(Node& child);
212 217
213 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return hasRareData() & & hasRestyleFlagInternal(mask); } 218 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return hasRareData() & & hasRestyleFlagInternal(mask); }
214 bool hasRestyleFlags() const { return hasRareData() && hasRestyleFlagsIntern al(); } 219 bool hasRestyleFlags() const { return hasRareData() && hasRestyleFlagsIntern al(); }
215 void setRestyleFlag(DynamicRestyleFlags); 220 void setRestyleFlag(DynamicRestyleFlags);
216 bool hasRestyleFlagInternal(DynamicRestyleFlags) const; 221 bool hasRestyleFlagInternal(DynamicRestyleFlags) const;
217 bool hasRestyleFlagsInternal() const; 222 bool hasRestyleFlagsInternal() const;
218 223
219 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Except ionState&) const; 224 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Except ionState&) const;
220 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc eptionState&) const; 225 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc eptionState&) const;
221 inline bool containsConsideringHostElements(const Node&) const; 226 inline bool containsConsideringHostElements(const Node&) const;
222 inline bool isChildTypeAllowed(const Node& child) const; 227 inline bool isChildTypeAllowed(const Node& child) const;
223 228
224 void attachChildren(const AttachContext& = AttachContext()); 229 void attachChildren(const AttachContext& = AttachContext());
225 void detachChildren(const AttachContext& = AttachContext()); 230 void detachChildren(const AttachContext& = AttachContext());
226 231
227 bool getUpperLeftCorner(FloatPoint&) const; 232 bool getUpperLeftCorner(FloatPoint&) const;
228 bool getLowerRightCorner(FloatPoint&) const; 233 bool getLowerRightCorner(FloatPoint&) const;
229 234
230 Node* m_firstChild; 235 RawPtrWillBeMember<Node> m_firstChild;
231 Node* m_lastChild; 236 RawPtrWillBeMember<Node> m_lastChild;
232 }; 237 };
233 238
234 #ifndef NDEBUG 239 #ifndef NDEBUG
235 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); 240 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*);
236 #endif 241 #endif
237 242
238 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); 243 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode());
239 244
240 inline bool ContainerNode::hasChildCount(unsigned count) const 245 inline bool ContainerNode::hasChildCount(unsigned count) const
241 { 246 {
242 Node* child = m_firstChild; 247 Node* child = m_firstChild;
243 while (count && child) { 248 while (count && child) {
244 child = child->nextSibling(); 249 child = child->nextSibling();
245 --count; 250 --count;
246 } 251 }
247 return !count && !child; 252 return !count && !child;
248 } 253 }
249 254
250 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) 255 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type)
251 : Node(treeScope, type) 256 : Node(treeScope, type)
252 , m_firstChild(0) 257 , m_firstChild(nullptr)
253 , m_lastChild(0) 258 , m_lastChild(nullptr)
254 { 259 {
255 } 260 }
256 261
257 inline void ContainerNode::attachChildren(const AttachContext& context) 262 inline void ContainerNode::attachChildren(const AttachContext& context)
258 { 263 {
259 AttachContext childrenContext(context); 264 AttachContext childrenContext(context);
260 childrenContext.resolvedStyle = 0; 265 childrenContext.resolvedStyle = 0;
261 266
262 for (Node* child = firstChild(); child; child = child->nextSibling()) { 267 for (Node* child = firstChild(); child; child = child->nextSibling()) {
263 ASSERT(child->needsAttach() || childAttachedAllowedWhenAttachingChildren (this)); 268 ASSERT(child->needsAttach() || childAttachedAllowedWhenAttachingChildren (this));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 397
393 RefPtr<Node> m_currentNode; 398 RefPtr<Node> m_currentNode;
394 unsigned m_currentIndex; 399 unsigned m_currentIndex;
395 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. 400 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated.
396 ChildNodesLazySnapshot* m_nextSnapshot; 401 ChildNodesLazySnapshot* m_nextSnapshot;
397 }; 402 };
398 403
399 } // namespace WebCore 404 } // namespace WebCore
400 405
401 #endif // ContainerNode_h 406 #endif // ContainerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698