Title: [102882] trunk/Source/WebCore
- Revision
- 102882
- Author
- [email protected]
- Date
- 2011-12-14 21:26:55 -0800 (Wed, 14 Dec 2011)
Log Message
Optimize MutationObserverInterestGroup construction
https://bugs.webkit.org/show_bug.cgi?id=74563
Reviewed by Ojan Vafai.
Inline MutationObserverInterestGroup's creation methods and fix an
accidental pass-by-value in an attempt to further reduce the CPU
footprint of MutationObservers.
No new tests, refactor only.
* dom/WebKitMutationObserver.cpp:
(WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Pass observers HashMap by reference.
* dom/WebKitMutationObserver.h:
(WebCore::MutationObserverInterestGroup::createForChildListMutation): Inline.
(WebCore::MutationObserverInterestGroup::createForCharacterDataMutation): Inline.
(WebCore::MutationObserverInterestGroup::createForAttributesMutation): Inline.
(WebCore::MutationObserverInterestGroup::hasOldValue): Remove spurious inline keyword.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102881 => 102882)
--- trunk/Source/WebCore/ChangeLog 2011-12-15 05:22:19 UTC (rev 102881)
+++ trunk/Source/WebCore/ChangeLog 2011-12-15 05:26:55 UTC (rev 102882)
@@ -1,3 +1,24 @@
+2011-12-14 Adam Klein <[email protected]>
+
+ Optimize MutationObserverInterestGroup construction
+ https://bugs.webkit.org/show_bug.cgi?id=74563
+
+ Reviewed by Ojan Vafai.
+
+ Inline MutationObserverInterestGroup's creation methods and fix an
+ accidental pass-by-value in an attempt to further reduce the CPU
+ footprint of MutationObservers.
+
+ No new tests, refactor only.
+
+ * dom/WebKitMutationObserver.cpp:
+ (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Pass observers HashMap by reference.
+ * dom/WebKitMutationObserver.h:
+ (WebCore::MutationObserverInterestGroup::createForChildListMutation): Inline.
+ (WebCore::MutationObserverInterestGroup::createForCharacterDataMutation): Inline.
+ (WebCore::MutationObserverInterestGroup::createForAttributesMutation): Inline.
+ (WebCore::MutationObserverInterestGroup::hasOldValue): Remove spurious inline keyword.
+
2011-12-14 Dominic Mazzoni <[email protected]>
Seeing crash in DRT after loading-iframe-sends-notification.html land
Modified: trunk/Source/WebCore/dom/WebKitMutationObserver.cpp (102881 => 102882)
--- trunk/Source/WebCore/dom/WebKitMutationObserver.cpp 2011-12-15 05:22:19 UTC (rev 102881)
+++ trunk/Source/WebCore/dom/WebKitMutationObserver.cpp 2011-12-15 05:26:55 UTC (rev 102882)
@@ -162,23 +162,7 @@
return adoptPtr(new MutationObserverInterestGroup(observers, oldValueFlag));
}
-PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForChildListMutation(Node* target)
-{
- MutationRecordDeliveryOptions oldValueFlag = 0;
- return createIfNeeded(target, WebKitMutationObserver::ChildList, nullAtom, oldValueFlag);
-}
-
-PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForCharacterDataMutation(Node* target)
-{
- return createIfNeeded(target, WebKitMutationObserver::CharacterData, nullAtom, WebKitMutationObserver::CharacterDataOldValue);
-}
-
-PassOwnPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createForAttributesMutation(Node* target, const QualifiedName& attributeName)
-{
- return createIfNeeded(target, WebKitMutationObserver::Attributes, attributeName.localName(), WebKitMutationObserver::AttributeOldValue);
-}
-
-MutationObserverInterestGroup::MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers, MutationRecordDeliveryOptions oldValueFlag)
+MutationObserverInterestGroup::MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, MutationRecordDeliveryOptions oldValueFlag)
: m_oldValueFlag(oldValueFlag)
{
ASSERT(!observers.isEmpty());
Modified: trunk/Source/WebCore/dom/WebKitMutationObserver.h (102881 => 102882)
--- trunk/Source/WebCore/dom/WebKitMutationObserver.h 2011-12-15 05:22:19 UTC (rev 102881)
+++ trunk/Source/WebCore/dom/WebKitMutationObserver.h 2011-12-15 05:26:55 UTC (rev 102882)
@@ -33,8 +33,10 @@
#if ENABLE(MUTATION_OBSERVERS)
+#include "QualifiedName.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
@@ -98,17 +100,28 @@
class MutationObserverInterestGroup {
public:
- static PassOwnPtr<MutationObserverInterestGroup> createForChildListMutation(Node* target);
- static PassOwnPtr<MutationObserverInterestGroup> createForCharacterDataMutation(Node* target);
- static PassOwnPtr<MutationObserverInterestGroup> createForAttributesMutation(Node* target, const QualifiedName& attributeName);
+ static PassOwnPtr<MutationObserverInterestGroup> createForChildListMutation(Node* target)
+ {
+ MutationRecordDeliveryOptions oldValueFlag = 0;
+ return createIfNeeded(target, WebKitMutationObserver::ChildList, nullAtom, oldValueFlag);
+ }
+ static PassOwnPtr<MutationObserverInterestGroup> createForCharacterDataMutation(Node* target)
+ {
+ return createIfNeeded(target, WebKitMutationObserver::CharacterData, nullAtom, WebKitMutationObserver::CharacterDataOldValue);
+ }
+ static PassOwnPtr<MutationObserverInterestGroup> createForAttributesMutation(Node* target, const QualifiedName& attributeName)
+ {
+ return createIfNeeded(target, WebKitMutationObserver::Attributes, attributeName.localName(), WebKitMutationObserver::AttributeOldValue);
+ }
bool isOldValueRequested();
void enqueueMutationRecord(PassRefPtr<MutationRecord>);
+
private:
static PassOwnPtr<MutationObserverInterestGroup> createIfNeeded(Node* target, WebKitMutationObserver::MutationType, const AtomicString& attributeName, MutationRecordDeliveryOptions oldValueFlag);
- MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers, MutationRecordDeliveryOptions oldValueFlag);
+ MutationObserverInterestGroup(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, MutationRecordDeliveryOptions oldValueFlag);
- inline bool hasOldValue(MutationRecordDeliveryOptions options) { return options & m_oldValueFlag; }
+ bool hasOldValue(MutationRecordDeliveryOptions options) { return options & m_oldValueFlag; }
HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> m_observers;
MutationRecordDeliveryOptions m_oldValueFlag;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes