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

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

Issue 180143003: Have LiveNodeListBase::ownerNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/NameNodeList.cpp ('k') | Source/core/dom/TagCollection.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 /* 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 : m_childNodeList(0) 194 : m_childNodeList(0)
195 { } 195 { }
196 196
197 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name) 197 std::pair<unsigned char, StringImpl*> namedNodeListKey(CollectionType type, const AtomicString& name)
198 { 198 {
199 // Holding the raw StringImpl is safe because |name| is retained by the NodeList and the NodeList 199 // Holding the raw StringImpl is safe because |name| is retained by the NodeList and the NodeList
200 // is reponsible for removing itself from the cache on deletion. 200 // is reponsible for removing itself from the cache on deletion.
201 return std::pair<unsigned char, StringImpl*>(type, name.impl()); 201 return std::pair<unsigned char, StringImpl*>(type, name.impl());
202 } 202 }
203 203
204 bool deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(Node*); 204 bool deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(Node&);
205 205
206 // Can be a ChildNodeList or an EmptyNodeList. 206 // Can be a ChildNodeList or an EmptyNodeList.
207 NodeList* m_childNodeList; 207 NodeList* m_childNodeList;
208 NodeListAtomicNameCacheMap m_atomicNameCaches; 208 NodeListAtomicNameCacheMap m_atomicNameCaches;
209 TagCollectionCacheNS m_tagCollectionCacheNS; 209 TagCollectionCacheNS m_tagCollectionCacheNS;
210 }; 210 };
211 211
212 class NodeMutationObserverData { 212 class NodeMutationObserverData {
213 WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); WTF_MAKE_FAST_ALLOCATED; 213 WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); WTF_MAKE_FAST_ALLOCATED;
214 public: 214 public:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 , m_connectedFrameCount(0) 261 , m_connectedFrameCount(0)
262 { } 262 { }
263 263
264 private: 264 private:
265 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames. 265 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames.
266 266
267 OwnPtr<NodeListsNodeData> m_nodeLists; 267 OwnPtr<NodeListsNodeData> m_nodeLists;
268 OwnPtr<NodeMutationObserverData> m_mutationObserverData; 268 OwnPtr<NodeMutationObserverData> m_mutationObserverData;
269 }; 269 };
270 270
271 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node* ownerNode) 271 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node& ownerNode)
272 { 272 {
273 ASSERT(ownerNode); 273 ASSERT(ownerNode.nodeLists() == this);
274 ASSERT(ownerNode->nodeLists() == this);
275 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_tagCollectionC acheNS.size() != 1) 274 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_tagCollectionC acheNS.size() != 1)
276 return false; 275 return false;
277 ownerNode->clearNodeLists(); 276 ownerNode.clearNodeLists();
278 return true; 277 return true;
279 } 278 }
280 279
281 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 280 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
282 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 281 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
283 282
284 } // namespace WebCore 283 } // namespace WebCore
285 284
286 #endif // NodeRareData_h 285 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « Source/core/dom/NameNodeList.cpp ('k') | Source/core/dom/TagCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698