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

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

Issue 26852004: Have NodeRareData's ensureNodeLists() / ensureMutationObserverData() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/Node.cpp ('k') | Source/core/html/LabelableElement.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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 NodeMutationObserverData() { } 242 NodeMutationObserverData() { }
243 }; 243 };
244 244
245 class NodeRareData : public NodeRareDataBase { 245 class NodeRareData : public NodeRareDataBase {
246 WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; 246 WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
247 public: 247 public:
248 static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adop tPtr(new NodeRareData(renderer)); } 248 static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adop tPtr(new NodeRareData(renderer)); }
249 249
250 void clearNodeLists() { m_nodeLists.clear(); } 250 void clearNodeLists() { m_nodeLists.clear(); }
251 NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } 251 NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
252 NodeListsNodeData* ensureNodeLists() 252 NodeListsNodeData& ensureNodeLists()
253 { 253 {
254 if (!m_nodeLists) 254 if (!m_nodeLists)
255 m_nodeLists = NodeListsNodeData::create(); 255 m_nodeLists = NodeListsNodeData::create();
256 return m_nodeLists.get(); 256 return *m_nodeLists;
257 } 257 }
258 258
259 NodeMutationObserverData* mutationObserverData() { return m_mutationObserver Data.get(); } 259 NodeMutationObserverData* mutationObserverData() { return m_mutationObserver Data.get(); }
260 NodeMutationObserverData* ensureMutationObserverData() 260 NodeMutationObserverData& ensureMutationObserverData()
261 { 261 {
262 if (!m_mutationObserverData) 262 if (!m_mutationObserverData)
263 m_mutationObserverData = NodeMutationObserverData::create(); 263 m_mutationObserverData = NodeMutationObserverData::create();
264 return m_mutationObserverData.get(); 264 return *m_mutationObserverData;
265 } 265 }
266 266
267 unsigned connectedSubframeCount() const { return m_connectedFrameCount; } 267 unsigned connectedSubframeCount() const { return m_connectedFrameCount; }
268 void incrementConnectedSubframeCount(unsigned amount) 268 void incrementConnectedSubframeCount(unsigned amount)
269 { 269 {
270 m_connectedFrameCount += amount; 270 m_connectedFrameCount += amount;
271 } 271 }
272 void decrementConnectedSubframeCount(unsigned amount) 272 void decrementConnectedSubframeCount(unsigned amount)
273 { 273 {
274 ASSERT(m_connectedFrameCount); 274 ASSERT(m_connectedFrameCount);
(...skipping 23 matching lines...) Expand all
298 ownerNode->clearNodeLists(); 298 ownerNode->clearNodeLists();
299 return true; 299 return true;
300 } 300 }
301 301
302 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 302 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
303 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 303 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
304 304
305 } // namespace WebCore 305 } // namespace WebCore
306 306
307 #endif // NodeRareData_h 307 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/html/LabelableElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698