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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 1305163006: Oilpan: Decrease sizeof(Node) by 8 byte Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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.h ('k') | no next file » | 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) 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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "wtf/RefCountedLeakCounter.h" 92 #include "wtf/RefCountedLeakCounter.h"
93 #include "wtf/Vector.h" 93 #include "wtf/Vector.h"
94 #include "wtf/text/CString.h" 94 #include "wtf/text/CString.h"
95 #include "wtf/text/StringBuilder.h" 95 #include "wtf/text/StringBuilder.h"
96 96
97 namespace blink { 97 namespace blink {
98 98
99 using namespace HTMLNames; 99 using namespace HTMLNames;
100 100
101 struct SameSizeAsNode : NODE_BASE_CLASSES { 101 struct SameSizeAsNode : NODE_BASE_CLASSES {
102 #if !(ENABLE(OILPAN) && USE_4BYTE_HEADER_PADDING)
102 uint32_t m_nodeFlags; 103 uint32_t m_nodeFlags;
104 #endif
103 void* m_pointer[5]; 105 void* m_pointer[5];
104 }; 106 };
105 107
106 static_assert(sizeof(Node) <= sizeof(SameSizeAsNode), "Node should stay small"); 108 static_assert(sizeof(Node) <= sizeof(SameSizeAsNode), "Node should stay small");
107 109
108 #if !ENABLE(OILPAN) 110 #if !ENABLE(OILPAN)
109 void* Node::operator new(size_t size) 111 void* Node::operator new(size_t size)
110 { 112 {
111 ASSERT(isMainThread()); 113 ASSERT(isMainThread());
112 return partitionAlloc(WTF::Partitions::nodePartition(), size); 114 return partitionAlloc(WTF::Partitions::nodePartition(), size);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 #ifndef NDEBUG 251 #ifndef NDEBUG
250 nodeCounter.increment(); 252 nodeCounter.increment();
251 #endif 253 #endif
252 254
253 #if DUMP_NODE_STATISTICS 255 #if DUMP_NODE_STATISTICS
254 liveNodeSet().add(this); 256 liveNodeSet().add(this);
255 #endif 257 #endif
256 } 258 }
257 259
258 Node::Node(TreeScope* treeScope, ConstructionType type) 260 Node::Node(TreeScope* treeScope, ConstructionType type)
259 : m_nodeFlags(type) 261 : m_parentOrShadowHostNode(nullptr)
260 , m_parentOrShadowHostNode(nullptr)
261 , m_treeScope(treeScope) 262 , m_treeScope(treeScope)
262 , m_previous(nullptr) 263 , m_previous(nullptr)
263 , m_next(nullptr) 264 , m_next(nullptr)
264 { 265 {
266 NODE_FLAGS = type;
265 ASSERT(m_treeScope || type == CreateDocument || type == CreateShadowRoot); 267 ASSERT(m_treeScope || type == CreateDocument || type == CreateShadowRoot);
266 #if !ENABLE(OILPAN) 268 #if !ENABLE(OILPAN)
267 if (m_treeScope) 269 if (m_treeScope)
268 m_treeScope->guardRef(); 270 m_treeScope->guardRef();
269 #endif 271 #endif
270 272
271 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) 273 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS)
272 trackForDebugging(); 274 trackForDebugging();
273 #endif 275 #endif
274 InstanceCounters::incrementCounter(InstanceCounters::NodeCounter); 276 InstanceCounters::incrementCounter(InstanceCounters::NodeCounter);
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 701
700 void Node::markAncestorsWithChildNeedsDistributionRecalc() 702 void Node::markAncestorsWithChildNeedsDistributionRecalc()
701 { 703 {
702 for (Node* node = this; node && !node->childNeedsDistributionRecalc(); node = node->parentOrShadowHostNode()) 704 for (Node* node = this; node && !node->childNeedsDistributionRecalc(); node = node->parentOrShadowHostNode())
703 node->setChildNeedsDistributionRecalc(); 705 node->setChildNeedsDistributionRecalc();
704 document().scheduleLayoutTreeUpdateIfNeeded(); 706 document().scheduleLayoutTreeUpdateIfNeeded();
705 } 707 }
706 708
707 inline void Node::setStyleChange(StyleChangeType changeType) 709 inline void Node::setStyleChange(StyleChangeType changeType)
708 { 710 {
709 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 711 NODE_FLAGS = (NODE_FLAGS & ~StyleChangeMask) | changeType;
710 } 712 }
711 713
712 void Node::markAncestorsWithChildNeedsStyleRecalc() 714 void Node::markAncestorsWithChildNeedsStyleRecalc()
713 { 715 {
714 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode()) 716 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode())
715 p->setChildNeedsStyleRecalc(); 717 p->setChildNeedsStyleRecalc();
716 document().scheduleLayoutTreeUpdateIfNeeded(); 718 document().scheduleLayoutTreeUpdateIfNeeded();
717 document().incStyleVersion(); 719 document().incStyleVersion();
718 } 720 }
719 721
(...skipping 16 matching lines...) Expand all
736 738
737 if (existingChangeType == NoStyleChange) 739 if (existingChangeType == NoStyleChange)
738 markAncestorsWithChildNeedsStyleRecalc(); 740 markAncestorsWithChildNeedsStyleRecalc();
739 741
740 if (isElementNode() && hasRareData()) 742 if (isElementNode() && hasRareData())
741 toElement(*this).setAnimationStyleChange(false); 743 toElement(*this).setAnimationStyleChange(false);
742 } 744 }
743 745
744 void Node::clearNeedsStyleRecalc() 746 void Node::clearNeedsStyleRecalc()
745 { 747 {
746 m_nodeFlags &= ~StyleChangeMask; 748 NODE_FLAGS &= ~StyleChangeMask;
747 749
748 clearSVGFilterNeedsLayerUpdate(); 750 clearSVGFilterNeedsLayerUpdate();
749 751
750 if (isElementNode() && hasRareData()) 752 if (isElementNode() && hasRareData())
751 toElement(*this).setAnimationStyleChange(false); 753 toElement(*this).setAnimationStyleChange(false);
752 } 754 }
753 755
754 bool Node::inActiveDocument() const 756 bool Node::inActiveDocument() const
755 { 757 {
756 return inDocument() && document().isActive(); 758 return inDocument() && document().isActive();
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 2393
2392 void showNodePath(const blink::Node* node) 2394 void showNodePath(const blink::Node* node)
2393 { 2395 {
2394 if (node) 2396 if (node)
2395 node->showNodePathForThis(); 2397 node->showNodePathForThis();
2396 else 2398 else
2397 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2399 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2398 } 2400 }
2399 2401
2400 #endif 2402 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698