Changeset 102882 in webkit
- Timestamp:
- Dec 14, 2011 9:26:55 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102877 r102882 1 2011-12-14 Adam Klein <adamk@chromium.org> 2 3 Optimize MutationObserverInterestGroup construction 4 https://bugs.webkit.org/show_bug.cgi?id=74563 5 6 Reviewed by Ojan Vafai. 7 8 Inline MutationObserverInterestGroup's creation methods and fix an 9 accidental pass-by-value in an attempt to further reduce the CPU 10 footprint of MutationObservers. 11 12 No new tests, refactor only. 13 14 * dom/WebKitMutationObserver.cpp: 15 (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Pass observers HashMap by reference. 16 * dom/WebKitMutationObserver.h: 17 (WebCore::MutationObserverInterestGroup::createForChildListMutation): Inline. 18 (WebCore::MutationObserverInterestGroup::createForCharacterDataMutation): Inline. 19 (WebCore::MutationObserverInterestGroup::createForAttributesMutation): Inline. 20 (WebCore::MutationObserverInterestGroup::hasOldValue): Remove spurious inline keyword. 21 1 22 2011-12-14 Dominic Mazzoni <dmazzoni@google.com> 2 23 -
trunk/Source/WebCore/dom/WebKitMutationObserver.cpp
r102721 r102882 163 163 } 164 164 165 PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForChildListMutation(Node* target) 166 { 167 MutationRecordDeliveryOptions oldValueFlag = 0; 168 return createIfNeeded(target, WebKitMutationObserver::ChildList, nullAtom, oldValueFlag); 169 } 170 171 PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForCharacterDataMutation(Node* target) 172 { 173 return createIfNeeded(target, WebKitMutationObserver::CharacterData, nullAtom, WebKitMutationObserver::CharacterDataOldValue); 174 } 175 176 PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForAttributesMutation(Node* target, const QualifiedName& attributeName) 177 { 178 return createIfNeeded(target, WebKitMutationObserver::Attributes, attributeName.localName(), WebKitMutationObserver::AttributeOldValue); 179 } 180 181 MutationObserverInterestGroup::MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers, MutationRecordDeliveryOptions oldValueFlag) 165 MutationObserverInterestGroup::MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, MutationRecordDeliveryOptions oldValueFlag) 182 166 : m_oldValueFlag(oldValueFlag) 183 167 { -
trunk/Source/WebCore/dom/WebKitMutationObserver.h
r102721 r102882 34 34 #if ENABLE(MUTATION_OBSERVERS) 35 35 36 #include "QualifiedName.h" 36 37 #include <wtf/HashMap.h> 37 38 #include <wtf/HashSet.h> 39 #include <wtf/PassOwnPtr.h> 38 40 #include <wtf/PassRefPtr.h> 39 41 #include <wtf/RefCounted.h> … … 99 101 class MutationObserverInterestGroup { 100 102 public: 101 static PassOwnPtr<MutationObserverInterestGroup> createForChildListMutation(Node* target); 102 static PassOwnPtr<MutationObserverInterestGroup> createForCharacterDataMutation(Node* target); 103 static PassOwnPtr<MutationObserverInterestGroup> createForAttributesMutation(Node* target, const QualifiedName& attributeName); 103 static PassOwnPtr<MutationObserverInterestGroup> createForChildListMutation(Node* target) 104 { 105 MutationRecordDeliveryOptions oldValueFlag = 0; 106 return createIfNeeded(target, WebKitMutationObserver::ChildList, nullAtom, oldValueFlag); 107 } 108 static PassOwnPtr<MutationObserverInterestGroup> createForCharacterDataMutation(Node* target) 109 { 110 return createIfNeeded(target, WebKitMutationObserver::CharacterData, nullAtom, WebKitMutationObserver::CharacterDataOldValue); 111 } 112 static PassOwnPtr<MutationObserverInterestGroup> createForAttributesMutation(Node* target, const QualifiedName& attributeName) 113 { 114 return createIfNeeded(target, WebKitMutationObserver::Attributes, attributeName.localName(), WebKitMutationObserver::AttributeOldValue); 115 } 104 116 105 117 bool isOldValueRequested(); 106 118 void enqueueMutationRecord(PassRefPtr<MutationRecord>); 119 107 120 private: 108 121 static PassOwnPtr<MutationObserverInterestGroup> createIfNeeded(Node* target, WebKitMutationObserver::MutationType, const AtomicString& attributeName, MutationRecordDeliveryOptions oldValueFlag); 109 MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers, MutationRecordDeliveryOptions oldValueFlag);122 MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, MutationRecordDeliveryOptions oldValueFlag); 110 123 111 inlinebool hasOldValue(MutationRecordDeliveryOptions options) { return options & m_oldValueFlag; }124 bool hasOldValue(MutationRecordDeliveryOptions options) { return options & m_oldValueFlag; } 112 125 113 126 HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> m_observers;
Note: See TracChangeset
for help on using the changeset viewer.