Changeset 183009 in webkit
- Timestamp:
- Apr 20, 2015, 2:18:26 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r182998 r183009 1 2015-04-20 Andreas Kling <akling@apple.com> 2 3 Merge TreeShared into Node. 4 <https://webkit.org/b/143942> 5 6 Reviewed by Darin Adler. 7 8 Node was the only remaining user of TreeShared, so just fold the class into Node. 9 10 * WebCore.vcxproj/WebCore.vcxproj: 11 * WebCore.vcxproj/WebCore.vcxproj.filters: 12 * WebCore.xcodeproj/project.pbxproj: 13 * dom/Node.cpp: 14 (WebCore::Node::Node): 15 (WebCore::Node::~Node): 16 * dom/Node.h: 17 (WebCore::Node::ref): 18 (WebCore::Node::deref): 19 (WebCore::Node::hasOneRef): 20 (WebCore::Node::refCount): 21 (WebCore::adopted): 22 (WebCore::Node::hasTreeSharedParent): Deleted. 23 * platform/TreeShared.h: Removed. 24 1 25 2015-04-19 Benjamin Poulain <benjamin@webkit.org> 2 26 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r182768 r183009 19898 19898 <ClInclude Include="..\platform\ThreadTimers.h" /> 19899 19899 <ClInclude Include="..\platform\Timer.h" /> 19900 <ClInclude Include="..\platform\TreeShared.h" />19901 19900 <ClInclude Include="..\platform\UserActivity.h" /> 19902 19901 <ClInclude Include="..\platform\HysteresisActivity.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r182768 r183009 8311 8311 <Filter>platform</Filter> 8312 8312 </ClInclude> 8313 <ClInclude Include="..\platform\TreeShared.h">8314 <Filter>platform</Filter>8315 </ClInclude>8316 8313 <ClInclude Include="..\platform\UserActivity.h"> 8317 8314 <Filter>platform</Filter> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r182808 r183009 585 585 14115B7309F84CD600CA4FC1 /* JSNodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */; }; 586 586 1411DCB1164C39A800D49BC1 /* WidthCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1411DCB0164C39A800D49BC1 /* WidthCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 587 1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */ = {isa = PBXBuildFile; fileRef = 1419D2C40CEA6F6100FF507A /* TreeShared.h */; settings = {ATTRIBUTES = (Private, ); }; };588 587 141DC0481648348F00371E5A /* LayoutUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 141DC0471648348F00371E5A /* LayoutUnit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 589 588 141DC04F164834B900371E5A /* LayoutBoxExtent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 141DC049164834B900371E5A /* LayoutBoxExtent.cpp */; }; … … 7634 7633 14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNodeFilter.h; sourceTree = "<group>"; }; 7635 7634 1411DCB0164C39A800D49BC1 /* WidthCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WidthCache.h; sourceTree = "<group>"; }; 7636 1419D2C40CEA6F6100FF507A /* TreeShared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreeShared.h; sourceTree = "<group>"; };7637 7635 141B94E509EC4223000E9413 /* MouseEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = MouseEvent.idl; sourceTree = "<group>"; }; 7638 7636 141B94EE09EC425A000E9413 /* UIEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = UIEvent.idl; sourceTree = "<group>"; }; … … 21768 21766 93309EA1099EB78C0056E581 /* Timer.cpp */, 21769 21767 9305B24C098F1B6B00C28855 /* Timer.h */, 21770 1419D2C40CEA6F6100FF507A /* TreeShared.h */,21771 21768 6593923509AE4346002C531F /* URL.cpp */, 21772 21769 6593923609AE4346002C531F /* URL.h */, … … 26859 26856 14D64B5D134A5B6B00E58FDA /* TreeScope.h in Headers */, 26860 26857 A77E1FF014AACB6E005B7CB6 /* TreeScopeAdopter.h in Headers */, 26861 1419D2C50CEA6F6100FF507A /* TreeShared.h in Headers */,26862 26858 854FE7390A2297BE0058D7AD /* TreeWalker.h in Headers */, 26863 26859 C375D7FE16639519006184AB /* TypeAhead.h in Headers */, -
trunk/Source/WebCore/dom/Node.cpp
r182349 r183009 288 288 289 289 Node::Node(Document& document, ConstructionType type) 290 : m_nodeFlags(type) 290 : m_refCount(1) 291 , m_nodeFlags(type) 291 292 , m_parentNode(nullptr) 292 293 , m_treeScope(&document) … … 294 295 , m_next(nullptr) 295 296 { 297 ASSERT(isMainThread()); 298 296 299 document.incrementReferencingNodeCount(); 297 300 … … 303 306 Node::~Node() 304 307 { 308 ASSERT(isMainThread()); 309 ASSERT(!m_refCount); 310 ASSERT(m_deletionHasBegun); 311 ASSERT(!m_adoptionIsRequired); 312 305 313 #ifndef NDEBUG 306 314 if (!ignoreSet().remove(this)) -
trunk/Source/WebCore/dom/Node.h
r181418 r183009 33 33 #include "ScriptWrappable.h" 34 34 #include "TreeScope.h" 35 #include "TreeShared.h"36 35 #include <wtf/Forward.h> 37 36 #include <wtf/ListHashSet.h> 37 #include <wtf/MainThread.h> 38 38 #include <wtf/TypeCasts.h> 39 40 namespace JSC {41 class VM;42 class SlotVisitor;43 }44 45 namespace WTF {46 class AtomicString;47 }48 39 49 40 // This needs to be here because Document.h also depends on it. … … 121 112 }; 122 113 123 class Node : public EventTarget, public ScriptWrappable , public TreeShared<Node>{114 class Node : public EventTarget, public ScriptWrappable { 124 115 friend class Document; 125 116 friend class TreeScope; … … 545 536 virtual void defaultEventHandler(Event*); 546 537 547 using TreeShared<Node>::ref; 548 using TreeShared<Node>::deref; 538 void ref(); 539 void deref(); 540 bool hasOneRef() const; 541 int refCount() const; 542 543 #ifndef NDEBUG 544 bool m_deletionHasBegun { false }; 545 bool m_inRemovedLastRefFunction { false }; 546 bool m_adoptionIsRequired { true }; 547 #endif 549 548 550 549 virtual EventTargetData* eventTargetData() override final; … … 669 668 670 669 private: 671 friend class TreeShared<Node>;672 673 670 virtual PseudoId customPseudoId() const 674 671 { … … 678 675 679 676 WEBCORE_EXPORT void removedLastRef(); 680 bool hasTreeSharedParent() const { return !!parentNode(); }681 677 682 678 virtual void refEventTarget() override; … … 691 687 HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry(); 692 688 689 int m_refCount; 693 690 mutable uint32_t m_nodeFlags; 691 694 692 ContainerNode* m_parentNode; 695 693 TreeScope* m_treeScope; … … 709 707 }; 710 708 709 #ifndef NDEBUG 710 inline void adopted(Node* node) 711 { 712 if (!node) 713 return; 714 ASSERT(!node->m_deletionHasBegun); 715 ASSERT(!node->m_inRemovedLastRefFunction); 716 node->m_adoptionIsRequired = false; 717 } 718 #endif 719 720 inline void Node::ref() 721 { 722 ASSERT(isMainThread()); 723 ASSERT(!m_deletionHasBegun); 724 ASSERT(!m_inRemovedLastRefFunction); 725 ASSERT(!m_adoptionIsRequired); 726 ++m_refCount; 727 } 728 729 inline void Node::deref() 730 { 731 ASSERT(isMainThread()); 732 ASSERT(m_refCount >= 0); 733 ASSERT(!m_deletionHasBegun); 734 ASSERT(!m_inRemovedLastRefFunction); 735 ASSERT(!m_adoptionIsRequired); 736 if (--m_refCount <= 0 && !parentNode()) { 737 #ifndef NDEBUG 738 m_inRemovedLastRefFunction = true; 739 #endif 740 removedLastRef(); 741 } 742 } 743 744 inline bool Node::hasOneRef() const 745 { 746 ASSERT(!m_deletionHasBegun); 747 ASSERT(!m_inRemovedLastRefFunction); 748 return m_refCount == 1; 749 } 750 751 inline int Node::refCount() const 752 { 753 return m_refCount; 754 } 755 711 756 // Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs() 712 757 inline void addSubresourceURL(ListHashSet<URL>& urls, const URL& url)
Note:
See TracChangeset
for help on using the changeset viewer.