WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-71577-20111104114555.patch (text/plain), 42.85 KB, created by
Rafael Weinstein
on 2011-11-04 11:45:56 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rafael Weinstein
Created:
2011-11-04 11:45:56 PDT
Size:
42.85 KB
patch
obsolete
>Subversion Revision: 99233 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 71c81a6575f9239c25232b58e900ef16b715b2ec..ea1e2ae711a2f0a3b00fa269178919e097a14d31 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,67 @@ >+2011-11-04 Rafael Weinstein <rafaelw@chromium.org> >+ >+ [MutationObservers] Refactor MutationObserverRegistration into its own class that is >+ referenced by registration points >+ >+ https://bugs.webkit.org/show_bug.cgi?id=71577 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ MutationObserverRegistration is now owned by the node which is observed. If transient >+ registrations are created, they hold a reference to this object. >+ >+ No tests required - refactor only. >+ >+ * GNUmakefile.list.am: >+ * WebCore.gypi: >+ * WebCore.pro: >+ * WebCore.vcproj/WebCore.vcproj: >+ * WebCore.xcodeproj/project.pbxproj: >+ * dom/CharacterData.cpp: >+ (WebCore::enqueueCharacterDataMutationRecord): >+ * dom/ChildListMutationScope.cpp: >+ (WebCore::MutationAccumulationRouter::MutationAccumulationRouter::incrementScopingLevel): >+ * dom/Element.cpp: >+ (WebCore::enqueueAttributesMutationRecord): >+ * dom/MutationObserverRegistration.cpp: Added. >+ (WebCore::MutationObserverRegistration::create): >+ (WebCore::MutationObserverRegistration::MutationObserverRegistration): >+ (WebCore::MutationObserverRegistration::~MutationObserverRegistration): >+ (WebCore::MutationObserverRegistration::resetObservation): >+ (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach): >+ (WebCore::MutationObserverRegistration::clearTransientRegistrations): >+ (WebCore::MutationObserverRegistration::unregister): >+ (WebCore::MutationObserverRegistration::shouldReceiveMutationFrom): >+ * dom/MutationObserverRegistration.h: Copied from Source/WebCore/dom/WebKitMutationObserver.h. >+ (WebCore::MutationObserverRegistration::observer): >+ (WebCore::MutationObserverRegistration::deliveryOptions): >+ * dom/Node.cpp: >+ (WebCore::Node::clearRareData): >+ (WebCore::Node::mutationObserverRegistry): >+ (WebCore::Node::transientMutationObserverRegistry): >+ (WebCore::addObserverToDeliverySet): >+ (WebCore::Node::collectMatchingObserversForMutation): >+ (WebCore::Node::getRegisteredMutationObserversOfType): >+ (WebCore::Node::registerMutationObserver): >+ (WebCore::Node::unregisterMutationObserver): >+ (WebCore::Node::registerTransientMutationObserver): >+ (WebCore::Node::unregisterTransientMutationObserver): >+ (WebCore::Node::notifyMutationObserversNodeWillDetach): >+ * dom/Node.h: >+ * dom/NodeRareData.h: >+ (WebCore::NodeRareData::mutationObserverRegistry): >+ (WebCore::NodeRareData::ensureMutationObserverRegistry): >+ (WebCore::NodeRareData::transientMutationObserverRegistry): >+ (WebCore::NodeRareData::ensureTransientMutationObserverRegistry): >+ * dom/WebKitMutationObserver.cpp: >+ (WebCore::WebKitMutationObserver::~WebKitMutationObserver): >+ (WebCore::WebKitMutationObserver::observe): >+ (WebCore::WebKitMutationObserver::disconnect): >+ (WebCore::WebKitMutationObserver::observationStarted): >+ (WebCore::WebKitMutationObserver::observationEnded): >+ (WebCore::WebKitMutationObserver::deliver): >+ * dom/WebKitMutationObserver.h: >+ > 2011-11-03 Joshua Bell <jsbell@chromium.org> > > IndexedDB result of deleting a record should be true or false >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index 184825cccedb9be08b317ce019ee0e8a5fda4acc..ad19191fb154f7f1b990e825ff32d873d3e24090 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -1262,6 +1262,8 @@ webcore_sources += \ > Source/WebCore/dom/MutationCallback.h \ > Source/WebCore/dom/MutationEvent.cpp \ > Source/WebCore/dom/MutationEvent.h \ >+ Source/WebCore/dom/MutationObserverRegistration.cpp \ >+ Source/WebCore/dom/MutationObserverRegistration.h \ > Source/WebCore/dom/MutationRecord.cpp \ > Source/WebCore/dom/MutationRecord.h \ > Source/WebCore/dom/NamedNodeMap.cpp \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 05f213e62ffbaa973f6719a2b0e2d16e206be2c1..308413798ac803984d7b68df55e753182ed52e0f 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -5257,6 +5257,8 @@ > 'dom/MutationCallback.h', > 'dom/MutationEvent.cpp', > 'dom/MutationEvent.h', >+ 'dom/MutationObserverRegistration.cpp', >+ 'dom/MutationObserverRegistration.h', > 'dom/MutationRecord.cpp', > 'dom/MutationRecord.h', > 'dom/NameNodeList.cpp', >diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro >index 89c9744aba08da19e11b3502f9d84d75c32829c6..ae0cb7b5c208e2c09f8359db8698a08629bf22b0 100644 >--- a/Source/WebCore/WebCore.pro >+++ b/Source/WebCore/WebCore.pro >@@ -522,6 +522,7 @@ SOURCES += \ > dom/MouseEvent.cpp \ > dom/MouseRelatedEvent.cpp \ > dom/MutationEvent.cpp \ >+ dom/MutationObserverRegistration.cpp \ > dom/MutationRecord.cpp \ > dom/NamedNodeMap.cpp \ > dom/NameNodeList.cpp \ >@@ -1598,6 +1599,7 @@ HEADERS += \ > dom/MouseRelatedEvent.h \ > dom/MutationCallback.h \ > dom/MutationEvent.h \ >+ dom/MutationObserverRegistration.h \ > dom/MutationRecord.h \ > dom/NamedNodeMap.h \ > dom/NameNodeList.h \ >diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >index fd69611fd8c4dbecc11e4ee5b260b2acb6904bea..245d800d8bd38d470bb0c31a6721b65c6fa6424f 100755 >--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj >+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >@@ -46634,6 +46634,62 @@ > > > </File> > <File >+ RelativePath="..\dom\MutationObserverRegistration.cpp" >+ > >+ <FileConfiguration >+ Name="Debug|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Release|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Debug_Cairo_CFLite|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Release_Cairo_CFLite|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Debug_All|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ <FileConfiguration >+ Name="Production|Win32" >+ ExcludedFromBuild="true" >+ > >+ <Tool >+ Name="VCCLCompilerTool" >+ /> >+ </FileConfiguration> >+ </File> >+ <File >+ RelativePath="..\dom\MutationObserverRegistration.h" >+ > >+ </File> >+ <File > RelativePath="..\dom\MutationRecord.cpp" > > > <FileConfiguration >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index f18d9c2fadd774cdee89f8b391cdb5ab612bc5fc..48d6062e6807ab88fb3a83bf5a61519957e70ed7 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -5771,6 +5771,8 @@ > D3D4E973130C7CFE007BA540 /* HTMLSummaryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */; }; > D619A307144E00BE004BC302 /* ChildListMutationScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D619A305144E00BE004BC302 /* ChildListMutationScope.cpp */; }; > D619A308144E00BE004BC302 /* ChildListMutationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = D619A306144E00BE004BC302 /* ChildListMutationScope.h */; }; >+ D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6E276AD14637455001D280A /* MutationObserverRegistration.cpp */; }; >+ D6E276B014637455001D280A /* MutationObserverRegistration.h in Headers */ = {isa = PBXBuildFile; fileRef = D6E276AE14637455001D280A /* MutationObserverRegistration.h */; }; > D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D70AD65513E1342B005B50B4 /* RenderRegion.cpp */; }; > D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = D70AD65613E1342B005B50B4 /* RenderRegion.h */; }; > D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -13063,6 +13065,8 @@ > D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSummaryElement.h; sourceTree = "<group>"; }; > D619A305144E00BE004BC302 /* ChildListMutationScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildListMutationScope.cpp; sourceTree = "<group>"; }; > D619A306144E00BE004BC302 /* ChildListMutationScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildListMutationScope.h; sourceTree = "<group>"; }; >+ D6E276AD14637455001D280A /* MutationObserverRegistration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutationObserverRegistration.cpp; sourceTree = "<group>"; }; >+ D6E276AE14637455001D280A /* MutationObserverRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutationObserverRegistration.h; sourceTree = "<group>"; }; > D70AD65513E1342B005B50B4 /* RenderRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRegion.cpp; sourceTree = "<group>"; }; > D70AD65613E1342B005B50B4 /* RenderRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRegion.h; sourceTree = "<group>"; }; > D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; >@@ -21073,6 +21077,8 @@ > 85031B330A44EFC700F992E0 /* MutationEvent.cpp */, > 85031B340A44EFC700F992E0 /* MutationEvent.h */, > 93EEC1F309C2877700C515D1 /* MutationEvent.idl */, >+ D6E276AD14637455001D280A /* MutationObserverRegistration.cpp */, >+ D6E276AE14637455001D280A /* MutationObserverRegistration.h */, > C6F08FB91430FE8F00685849 /* MutationRecord.cpp */, > C6F08FBA1430FE8F00685849 /* MutationRecord.h */, > C6F08FBB1430FE8F00685849 /* MutationRecord.idl */, >@@ -23551,6 +23557,7 @@ > 93309DFC099E64920056E581 /* MoveSelectionCommand.h in Headers */, > C6F0900A14327B6100685849 /* MutationCallback.h in Headers */, > 85031B4A0A44EFC700F992E0 /* MutationEvent.h in Headers */, >+ D6E276B014637455001D280A /* MutationObserverRegistration.h in Headers */, > C6F08FBD1430FE8F00685849 /* MutationRecord.h in Headers */, > A81872230977D3C0005826D9 /* NamedNodeMap.h in Headers */, > A818721E0977D3C0005826D9 /* NameNodeList.h in Headers */, >@@ -26602,6 +26609,7 @@ > 85031B470A44EFC700F992E0 /* MouseRelatedEvent.cpp in Sources */, > 93309DFB099E64920056E581 /* MoveSelectionCommand.cpp in Sources */, > 85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */, >+ D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */, > C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */, > BCF34A3711A231CD00C71804 /* NamedNodeMap.cpp in Sources */, > A81872240977D3C0005826D9 /* NameNodeList.cpp in Sources */, >diff --git a/Source/WebCore/dom/CharacterData.cpp b/Source/WebCore/dom/CharacterData.cpp >index 3a5fd6fedb09baf224c45b4e54465e965b48ca50..c11966f21654dd754159ef13ffb0dd5b99a57864 100644 >--- a/Source/WebCore/dom/CharacterData.cpp >+++ b/Source/WebCore/dom/CharacterData.cpp >@@ -205,7 +205,7 @@ static bool isOldValueRequested(const HashMap<WebKitMutationObserver*, MutationO > > static void enqueueCharacterDataMutationRecord(Node* node, const String& oldData) > { >- HashMap<WebKitMutationObserver*, MutationObserverOptions> observers; >+ HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers; > node->getRegisteredMutationObserversOfType(observers, WebKitMutationObserver::CharacterData); > if (observers.isEmpty()) > return; >diff --git a/Source/WebCore/dom/ChildListMutationScope.cpp b/Source/WebCore/dom/ChildListMutationScope.cpp >index 5dcbdcff30daa98cb901b7b6eea0e4d1698fe62b..509cec5b285ad5d968c012061497c6c3acc392c5 100644 >--- a/Source/WebCore/dom/ChildListMutationScope.cpp >+++ b/Source/WebCore/dom/ChildListMutationScope.cpp >@@ -41,6 +41,7 @@ > #include "StaticNodeList.h" > #include <wtf/HashMap.h> > #include <wtf/RefCounted.h> >+#include <wtf/text/AtomicString.h> > > namespace WebCore { > >@@ -244,7 +245,7 @@ void MutationAccumulationRouter::incrementScopingLevel(Node* target) > return; > } > >- HashMap<WebKitMutationObserver*, MutationObserverOptions> observers; >+ HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers; > target->getRegisteredMutationObserversOfType(observers, WebKitMutationObserver::ChildList); > if (observers.isEmpty()) > m_accumulations.set(target, 0); >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 39cabd836a03597b59f44e20146dfec0d025ea90..62c3eaf1be45e46c3ebf6f87d745efd6dc8b6ff7 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -633,7 +633,7 @@ static inline bool isOldValueRequested(const HashMap<WebKitMutationObserver*, Mu > > static void enqueueAttributesMutationRecord(Element* element, const QualifiedName& name, const AtomicString& oldValue) > { >- HashMap<WebKitMutationObserver*, MutationObserverOptions> observers; >+ HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions> observers; > element->getRegisteredMutationObserversOfType(observers, WebKitMutationObserver::Attributes); > if (observers.isEmpty()) > return; >diff --git a/Source/WebCore/dom/MutationObserverRegistration.cpp b/Source/WebCore/dom/MutationObserverRegistration.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..2a57ca22993cfe51290828fbb4f001688e090b2e >--- /dev/null >+++ b/Source/WebCore/dom/MutationObserverRegistration.cpp >@@ -0,0 +1,115 @@ >+/* >+ * Copyright (C) 2011 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if ENABLE(MUTATION_OBSERVERS) >+ >+#include "MutationObserverRegistration.h" >+ >+#include "Document.h" >+#include "Node.h" >+ >+namespace WebCore { >+ >+PassOwnPtr<MutationObserverRegistration> MutationObserverRegistration::create(PassRefPtr<WebKitMutationObserver> observer, Node* registrationNode) >+{ >+ return adoptPtr(new MutationObserverRegistration(observer, registrationNode)); >+} >+ >+MutationObserverRegistration::MutationObserverRegistration(PassRefPtr<WebKitMutationObserver> observer, Node* registrationNode) >+ : m_observer(observer) >+ , m_registrationNode(registrationNode) >+ , m_options(0) >+{ >+ m_observer->observationStarted(this); >+} >+ >+MutationObserverRegistration::~MutationObserverRegistration() >+{ >+ clearTransientRegistrations(); >+ m_observer->observationEnded(this); >+} >+ >+void MutationObserverRegistration::resetObservation(MutationObserverOptions options) >+{ >+ clearTransientRegistrations(); >+ >+ m_options = options; >+} >+ >+void MutationObserverRegistration::observedSubtreeNodeWillDetach(PassRefPtr<Node> node) >+{ >+ if (!(m_options & WebKitMutationObserver::Subtree)) >+ return; >+ >+ node->registerTransientMutationObserver(this); >+ >+ if (!m_transientRegistrationNodes) { >+ m_transientRegistrationNodes = adoptPtr(new NodeHashSet); >+ m_registrationNodeKeepAlive = m_registrationNode; // Balanced in clearTransientRegistrations. >+ } >+ m_transientRegistrationNodes->add(node); >+} >+ >+void MutationObserverRegistration::clearTransientRegistrations() >+{ >+ if (!m_transientRegistrationNodes) { >+ ASSERT(!m_registrationNodeKeepAlive); >+ return; >+ } >+ >+ ASSERT(m_registrationNodeKeepAlive); >+ for (NodeHashSet::iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter) >+ (*iter)->unregisterTransientMutationObserver(this); >+ >+ m_transientRegistrationNodes.clear(); >+ m_registrationNodeKeepAlive = 0; // Balanced in observeSubtreeNodeWillDetach. >+} >+ >+void MutationObserverRegistration::unregister() >+{ >+ m_registrationNode->unregisterMutationObserver(this); // This call will cause this object to be deleted. >+} >+ >+bool MutationObserverRegistration::shouldReceiveMutationFrom(Node* node, WebKitMutationObserver::MutationType type) >+{ >+ if (!(m_options & type)) >+ return false; >+ >+ if (m_registrationNode != node && !(m_options & WebKitMutationObserver::Subtree)) >+ return false; >+ >+ return true; >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MUTATION_OBSERVERS) >diff --git a/Source/WebCore/dom/MutationObserverRegistration.h b/Source/WebCore/dom/MutationObserverRegistration.h >new file mode 100644 >index 0000000000000000000000000000000000000000..63e841bb07cb8f01c16322ac6fa04823e19cd201 >--- /dev/null >+++ b/Source/WebCore/dom/MutationObserverRegistration.h >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2011 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions are >+ * met: >+ * >+ * * Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * * Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following disclaimer >+ * in the documentation and/or other materials provided with the >+ * distribution. >+ * * Neither the name of Google Inc. nor the names of its >+ * contributors may be used to endorse or promote products derived from >+ * this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef MutationObserverRegistration_h >+#define MutationObserverRegistration_h >+ >+#if ENABLE(MUTATION_OBSERVERS) >+ >+#include "WebKitMutationObserver.h" >+#include <wtf/HashSet.h> >+#include <wtf/text/AtomicString.h> >+#include <wtf/text/AtomicStringHash.h> >+ >+namespace WebCore { >+ >+class MutationObserverRegistration { >+public: >+ >+ static PassOwnPtr<MutationObserverRegistration> create(PassRefPtr<WebKitMutationObserver>, Node*); >+ >+ ~MutationObserverRegistration(); >+ >+ void resetObservation(MutationObserverOptions); >+ void observedSubtreeNodeWillDetach(PassRefPtr<Node>); >+ void clearTransientRegistrations(); >+ void unregister(); >+ >+ bool shouldReceiveMutationFrom(Node*, WebKitMutationObserver::MutationType); >+ >+ WebKitMutationObserver* observer() { return m_observer.get(); } >+ MutationRecordDeliveryOptions deliveryOptions() { return m_options & (WebKitMutationObserver::AttributeOldValue | WebKitMutationObserver::CharacterDataOldValue); } >+ >+private: >+ MutationObserverRegistration(PassRefPtr<WebKitMutationObserver>, Node*); >+ >+ RefPtr<WebKitMutationObserver> m_observer; >+ Node* m_registrationNode; // Back-pointer to the Node which owns this registration. >+ RefPtr<Node> m_registrationNodeKeepAlive; // This registration takes reference to its owning node while it has transient registrations. >+ typedef HashSet<RefPtr<Node> > NodeHashSet; >+ OwnPtr<NodeHashSet> m_transientRegistrationNodes; >+ >+ MutationObserverOptions m_options; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(MUTATION_OBSERVERS) >+ >+#endif // MutationObserverRegistration_h >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index badd07b29c1387ecf2f79b46bfea45e39fbcc0a9..7073ad87b40a4f41c6e06f98368672d5bd05a852 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -548,10 +548,7 @@ void Node::clearRareData() > treeScope()->removeNodeListCache(); > > #if ENABLE(MUTATION_OBSERVERS) >- if (Vector<MutationObserverRegistration>* registry = mutationObserverRegistry()) { >- for (size_t i = 0; i < registry->size(); ++i) >- registry->at(i).observer->observedNodeDestructed(this); >- } >+ ASSERT(!transientMutationObserverRegistry() || transientMutationObserverRegistry()->isEmpty()); > #endif > > NodeRareData::NodeRareDataMap& dataMap = NodeRareData::rareDataMap(); >@@ -2696,59 +2693,70 @@ EventTargetData* Node::ensureEventTargetData() > } > > #if ENABLE(MUTATION_OBSERVERS) >-Vector<MutationObserverRegistration>* Node::mutationObserverRegistry() >+Vector<OwnPtr<MutationObserverRegistration> >* Node::mutationObserverRegistry() > { > return hasRareData() ? rareData()->mutationObserverRegistry() : 0; > } > >-static void addMatchingObservers(HashMap<WebKitMutationObserver*, MutationObserverOptions>& observers, Vector<MutationObserverRegistration>* registry, MutationObserverOptions options) >+HashSet<MutationObserverRegistration*>* Node::transientMutationObserverRegistry() > { >- if (!registry) >- return; >+ return hasRareData() ? rareData()->transientMutationObserverRegistry() : 0; >+} > >- const size_t size = registry->size(); >- for (size_t i = 0; i < size; ++i) { >- MutationObserverRegistration& entry = registry->at(i); >+static inline void addObserverToDeliverySet(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, WebKitMutationObserver* observer, MutationRecordDeliveryOptions deliveryOptions) >+{ >+ pair<HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>::iterator, bool> result = observers.add(observer, deliveryOptions); >+ if (!result.second) >+ result.first->second |= deliveryOptions; >+} > >- if (!entry.hasAllOptions(options)) >- continue; >+void Node::collectMatchingObserversForMutation(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, Node* fromNode, WebKitMutationObserver::MutationType type) >+{ >+ if (Vector<OwnPtr<MutationObserverRegistration> >* registry = fromNode->mutationObserverRegistry()) { >+ const size_t size = registry->size(); >+ for (size_t i = 0; i < size; ++i) { >+ MutationObserverRegistration* registration = registry->at(i).get(); >+ if (registration->shouldReceiveMutationFrom(this, type)) >+ addObserverToDeliverySet(observers, registration->observer(), registration->deliveryOptions()); >+ } >+ } > >- pair<HashMap<WebKitMutationObserver*, MutationObserverOptions>::iterator, bool> result = observers.add(entry.observer.get(), entry.options); >- if (!result.second) >- result.first->second |= entry.options; >+ if (HashSet<MutationObserverRegistration*>* transientRegistry = fromNode->transientMutationObserverRegistry()) { >+ for (HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) { >+ MutationObserverRegistration* registration = *iter; >+ if (registration->shouldReceiveMutationFrom(this, type)) >+ addObserverToDeliverySet(observers, registration->observer(), registration->deliveryOptions()); >+ } > } > } > >-void Node::getRegisteredMutationObserversOfType(HashMap<WebKitMutationObserver*, MutationObserverOptions>& observers, WebKitMutationObserver::MutationType type) >+void Node::getRegisteredMutationObserversOfType(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>& observers, WebKitMutationObserver::MutationType type) > { >- addMatchingObservers(observers, mutationObserverRegistry(), type); >- for (Node* node = parentNode(); node; node = node->parentNode()) >- addMatchingObservers(observers, node->mutationObserverRegistry(), type | WebKitMutationObserver::Subtree); >+ for (Node* node = this; node; node = node->parentNode()) >+ collectMatchingObserversForMutation(observers, node, type); > } > >-Node::MutationRegistrationResult Node::registerMutationObserver(PassRefPtr<WebKitMutationObserver> observer, MutationObserverOptions options, Node* registrationNode) >+MutationObserverRegistration* Node::registerMutationObserver(PassRefPtr<WebKitMutationObserver> observer) > { >- Vector<MutationObserverRegistration>* registry = ensureRareData()->ensureMutationObserverRegistry(); >- MutationObserverRegistration registration(observer, options, registrationNode); >- >- size_t index = registry->find(registration); >- if (index == notFound) { >- registry->append(registration); >- return MutationObserverRegistered; >+ Vector<OwnPtr<MutationObserverRegistration> >* registry = ensureRareData()->ensureMutationObserverRegistry(); >+ for (size_t i = 0; i < registry->size(); ++i) { >+ if (registry->at(i)->observer() == observer) >+ return registry->at(i).get(); > } > >- registry->at(index).options = registration.options; >- return MutationRegistrationOptionsReset; >+ OwnPtr<MutationObserverRegistration> registration = MutationObserverRegistration::create(observer, this); >+ MutationObserverRegistration* registrationPtr = registration.get(); >+ registry->append(registration.release()); >+ return registrationPtr; > } > >-void Node::unregisterMutationObserver(PassRefPtr<WebKitMutationObserver> observer, Node* registrationNode) >+void Node::unregisterMutationObserver(MutationObserverRegistration* registration) > { >- Vector<MutationObserverRegistration>* registry = mutationObserverRegistry(); >+ Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRegistry(); > ASSERT(registry); > if (!registry) > return; > >- MutationObserverRegistration registration(observer, 0, registrationNode); > size_t index = registry->find(registration); > ASSERT(index != notFound); > if (index == notFound) >@@ -2757,23 +2765,34 @@ void Node::unregisterMutationObserver(PassRefPtr<WebKitMutationObserver> observe > registry->remove(index); > } > >+void Node::registerTransientMutationObserver(MutationObserverRegistration* registration) >+{ >+ ensureRareData()->ensureTransientMutationObserverRegistry()->add(registration); >+} >+ >+void Node::unregisterTransientMutationObserver(MutationObserverRegistration* registration) >+{ >+ HashSet<MutationObserverRegistration*>* transientRegistry = transientMutationObserverRegistry(); >+ ASSERT(transientRegistry); >+ if (!transientRegistry) >+ return; >+ >+ ASSERT(transientRegistry->contains(registration)); >+ transientRegistry->remove(registration); >+} >+ > void Node::notifyMutationObserversNodeWillDetach() > { > for (Node* node = parentNode(); node; node = node->parentNode()) { >- Vector<MutationObserverRegistration>* registry = node->mutationObserverRegistry(); >- if (!registry) >- continue; >- >- const size_t size = registry->size(); >- for (size_t i = 0; i < size; ++i) { >- MutationObserverRegistration& registration = registry->at(i); >- if (!registration.hasAllOptions(WebKitMutationObserver::Subtree)) >- continue; >+ if (Vector<OwnPtr<MutationObserverRegistration> >* registry = node->mutationObserverRegistry()) { >+ const size_t size = registry->size(); >+ for (size_t i = 0; i < size; ++i) >+ registry->at(i)->observedSubtreeNodeWillDetach(this); >+ } > >- Node* registrationNode = registration.registrationNode; >- if (!registrationNode) >- registrationNode = node; >- registration.observer->willDetachNodeInObservedSubtree(registrationNode, registration.options, this); >+ if (HashSet<MutationObserverRegistration*>* transientRegistry = node->transientMutationObserverRegistry()) { >+ for (HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) >+ (*iter)->observedSubtreeNodeWillDetach(this); > } > } > } >diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h >index c8a131970ccc30d55735042437ecac6510d9455d..548bc8a443d78aec5a00201a57401dec402b03ee 100644 >--- a/Source/WebCore/dom/Node.h >+++ b/Source/WebCore/dom/Node.h >@@ -34,6 +34,7 @@ > #include "WebKitMutationObserver.h" > #include <wtf/Forward.h> > #include <wtf/ListHashSet.h> >+#include <wtf/text/AtomicString.h> > > #if USE(JSC) > namespace JSC { >@@ -590,16 +591,11 @@ public: > #endif > > #if ENABLE(MUTATION_OBSERVERS) >- void getRegisteredMutationObserversOfType(HashMap<WebKitMutationObserver*, MutationObserverOptions>&, WebKitMutationObserver::MutationType); >- >- enum MutationRegistrationResult { >- MutationObserverRegistered, >- MutationRegistrationOptionsReset >- }; >- MutationRegistrationResult registerMutationObserver(PassRefPtr<WebKitMutationObserver>, MutationObserverOptions, Node* registrationNode = 0); >- >- void unregisterMutationObserver(PassRefPtr<WebKitMutationObserver>, Node* registrationNode = 0); >- >+ void getRegisteredMutationObserversOfType(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>&, WebKitMutationObserver::MutationType); >+ MutationObserverRegistration* registerMutationObserver(PassRefPtr<WebKitMutationObserver>); >+ void unregisterMutationObserver(MutationObserverRegistration*); >+ void registerTransientMutationObserver(MutationObserverRegistration*); >+ void unregisterTransientMutationObserver(MutationObserverRegistration*); > void notifyMutationObserversNodeWillDetach(); > #endif // ENABLE(MUTATION_OBSERVERS) > >@@ -727,7 +723,9 @@ private: > void trackForDebugging(); > > #if ENABLE(MUTATION_OBSERVERS) >- Vector<MutationObserverRegistration>* mutationObserverRegistry(); >+ Vector<OwnPtr<MutationObserverRegistration> >* mutationObserverRegistry(); >+ HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry(); >+ void collectMatchingObserversForMutation(HashMap<WebKitMutationObserver*, MutationRecordDeliveryOptions>&, Node* fromNode, WebKitMutationObserver::MutationType); > #endif > > mutable uint32_t m_nodeFlags; >diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h >index ecbd55922f4290bbb38da310970f058a0b564f4c..0aa1d53b4723ea5e0eff2abeec641947d3f90f8b 100644 >--- a/Source/WebCore/dom/NodeRareData.h >+++ b/Source/WebCore/dom/NodeRareData.h >@@ -29,6 +29,7 @@ > #include "MicroDataItemList.h" > #endif > >+#include "MutationObserverRegistration.h" > #include "NameNodeList.h" > #include "QualifiedName.h" > #include "TagNodeList.h" >@@ -36,6 +37,7 @@ > #include <wtf/HashSet.h> > #include <wtf/OwnPtr.h> > #include <wtf/PassOwnPtr.h> >+#include <wtf/text/AtomicString.h> > #include <wtf/text/StringHash.h> > > namespace WebCore { >@@ -88,36 +90,6 @@ private: > NodeListsNodeData() : m_labelsNodeListCache(0) {} > }; > >-#if ENABLE(MUTATION_OBSERVERS) >-struct MutationObserverRegistration { >- MutationObserverRegistration(PassRefPtr<WebKitMutationObserver> observer, MutationObserverOptions options, Node* node) >- : observer(observer) >- , options(options) >- , registrationNode(node) >- { >- } >- >- bool operator==(const MutationObserverRegistration& other) const >- { >- return observer == other.observer && registrationNode == other.registrationNode; >- } >- >- bool hasAllOptions(MutationObserverOptions options) const >- { >- return (this->options & options) == options; >- } >- >- RefPtr<WebKitMutationObserver> observer; >- MutationObserverOptions options; >- >- // registrationNode will be 0 if the registration is non-transient. I.e. The registrationNode is the Node in whose >- // registry it exists. >- // Note that this doesn't need to be a RefPtr because the observer will be holding a RefPtr to the same node at >- // least for the lifetime of this Registration in its m_transientObservedNodes map. >- Node* registrationNode; >-}; >-#endif // ENABLE(MUTATION_OBSERVERS) >- > class NodeRareData { > WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; > public: >@@ -168,13 +140,21 @@ public: > } > > #if ENABLE(MUTATION_OBSERVERS) >- Vector<MutationObserverRegistration>* mutationObserverRegistry() { return m_mutationObserverRegistry.get(); } >- Vector<MutationObserverRegistration>* ensureMutationObserverRegistry() >+ Vector<OwnPtr<MutationObserverRegistration> >* mutationObserverRegistry() { return m_mutationObserverRegistry.get(); } >+ Vector<OwnPtr<MutationObserverRegistration> >* ensureMutationObserverRegistry() > { > if (!m_mutationObserverRegistry) >- m_mutationObserverRegistry = adoptPtr(new Vector<MutationObserverRegistration>); >+ m_mutationObserverRegistry = adoptPtr(new Vector<OwnPtr<MutationObserverRegistration> >); > return m_mutationObserverRegistry.get(); > } >+ >+ HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry() { return m_transientMutationObserverRegistry.get(); } >+ HashSet<MutationObserverRegistration*>* ensureTransientMutationObserverRegistry() >+ { >+ if (!m_transientMutationObserverRegistry) >+ m_transientMutationObserverRegistry = adoptPtr(new HashSet<MutationObserverRegistration*>); >+ return m_transientMutationObserverRegistry.get(); >+ } > #endif > > bool isFocused() const { return m_isFocused; } >@@ -195,7 +175,8 @@ private: > bool m_needsFocusAppearanceUpdateSoonAfterAttach : 1; > > #if ENABLE(MUTATION_OBSERVERS) >- OwnPtr<Vector<MutationObserverRegistration> > m_mutationObserverRegistry; >+ OwnPtr<Vector<OwnPtr<MutationObserverRegistration> > > m_mutationObserverRegistry; >+ OwnPtr<HashSet<MutationObserverRegistration*> > m_transientMutationObserverRegistry; > #endif > }; > >diff --git a/Source/WebCore/dom/WebKitMutationObserver.cpp b/Source/WebCore/dom/WebKitMutationObserver.cpp >index b66caa083ee99e4e5038bc46b1258c8b504560a9..0c7cbfc240d19e19cc1965def78a265750b6e760 100644 >--- a/Source/WebCore/dom/WebKitMutationObserver.cpp >+++ b/Source/WebCore/dom/WebKitMutationObserver.cpp >@@ -35,6 +35,7 @@ > #include "WebKitMutationObserver.h" > > #include "MutationCallback.h" >+#include "MutationObserverRegistration.h" > #include "MutationRecord.h" > #include "Node.h" > #include <wtf/ListHashSet.h> >@@ -53,51 +54,32 @@ WebKitMutationObserver::WebKitMutationObserver(PassRefPtr<MutationCallback> call > > WebKitMutationObserver::~WebKitMutationObserver() > { >- clearAllTransientObservations(); >-} >- >-static inline void clearTransientObservationsForRegistration(WebKitMutationObserver* observer, Node* registrationNode, PassOwnPtr<NodeHashSet> transientNodes) >-{ >- for (NodeHashSet::iterator iter = transientNodes->begin(); iter != transientNodes->end(); ++iter) >- (*iter)->unregisterMutationObserver(observer, registrationNode); >+ ASSERT(m_registrations.isEmpty()); > } > > void WebKitMutationObserver::observe(Node* node, MutationObserverOptions options) > { >- // FIXME: More options composition work needs to be done here, e.g., validation. >- >- if (node->registerMutationObserver(this, options) == Node::MutationObserverRegistered) { >- m_observedNodes.append(node); >- return; >- } >- >- HashMap<RefPtr<Node>, NodeHashSet*>::iterator iter = m_transientObservedNodes.find(node); >- if (iter == m_transientObservedNodes.end()) >- return; >- >- clearTransientObservationsForRegistration(this, node, adoptPtr(iter->second)); >- m_transientObservedNodes.remove(iter); >+ MutationObserverRegistration* registration = node->registerMutationObserver(this); >+ registration->resetObservation(options); > } > > void WebKitMutationObserver::disconnect() > { >- for (size_t i = 0; i < m_observedNodes.size(); ++i) >- m_observedNodes[i]->unregisterMutationObserver(this); >- >- m_observedNodes.clear(); >- clearAllTransientObservations(); >+ HashSet<MutationObserverRegistration*> registrations(m_registrations); >+ for (HashSet<MutationObserverRegistration*>::iterator iter = registrations.begin(); iter != registrations.end(); ++iter) >+ (*iter)->unregister(); > } > >-void WebKitMutationObserver::observedNodeDestructed(Node* node) >+void WebKitMutationObserver::observationStarted(MutationObserverRegistration* registration) > { >- ASSERT(!m_transientObservedNodes.contains(node)); >- >- size_t index = m_observedNodes.find(node); >- ASSERT(index != notFound); >- if (index == notFound) >- return; >+ ASSERT(!m_registrations.contains(registration)); >+ m_registrations.add(registration); >+} > >- m_observedNodes.remove(index); >+void WebKitMutationObserver::observationEnded(MutationObserverRegistration* registration) >+{ >+ ASSERT(m_registrations.contains(registration)); >+ m_registrations.remove(registration); > } > > typedef ListHashSet<RefPtr<WebKitMutationObserver> > MutationObserverSet; >@@ -114,36 +96,14 @@ void WebKitMutationObserver::enqueueMutationRecord(PassRefPtr<MutationRecord> mu > activeMutationObservers().add(this); > } > >-void WebKitMutationObserver::willDetachNodeInObservedSubtree(PassRefPtr<Node> prpRegistrationNode, MutationObserverOptions options, PassRefPtr<Node> prpDetachingNode) >-{ >- RefPtr<Node> registrationNode = prpRegistrationNode; >- RefPtr<Node> detachingNode = prpDetachingNode; >- >- detachingNode->registerMutationObserver(this, options, registrationNode.get()); >- HashMap<RefPtr<Node>, NodeHashSet*>::iterator iter = m_transientObservedNodes.find(registrationNode); >- if (iter != m_transientObservedNodes.end()) { >- iter->second->add(detachingNode); >- return; >- } >- >- OwnPtr<NodeHashSet> set = adoptPtr(new NodeHashSet()); >- set->add(detachingNode); >- m_transientObservedNodes.set(registrationNode, set.leakPtr()); >-} >- >-void WebKitMutationObserver::clearAllTransientObservations() >-{ >- for (HashMap<RefPtr<Node>, NodeHashSet*>::iterator iter = m_transientObservedNodes.begin(); iter != m_transientObservedNodes.end(); ++iter) >- clearTransientObservationsForRegistration(this, iter->first.get(), adoptPtr(iter->second)); >- >- m_transientObservedNodes.clear(); >-} >- > void WebKitMutationObserver::deliver() > { > MutationRecordArray records; > records.swap(m_records); >- clearAllTransientObservations(); >+ >+ for (HashSet<MutationObserverRegistration*>::iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter) >+ (*iter)->clearTransientRegistrations(); >+ > m_callback->handleEvent(&records, this); > } > >diff --git a/Source/WebCore/dom/WebKitMutationObserver.h b/Source/WebCore/dom/WebKitMutationObserver.h >index 753204c24794d4e382db02551ea5480354dc4a75..586141f7fd9959d1807460d69853b3fc7519e6ee 100644 >--- a/Source/WebCore/dom/WebKitMutationObserver.h >+++ b/Source/WebCore/dom/WebKitMutationObserver.h >@@ -33,21 +33,22 @@ > > #if ENABLE(MUTATION_OBSERVERS) > >-#include <wtf/HashMap.h> > #include <wtf/HashSet.h> >-#include <wtf/PassOwnPtr.h> >+#include <wtf/PassRefPtr.h> > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> >-#include <wtf/Vector.h> >+#include <wtf/text/AtomicString.h> >+#include <wtf/text/AtomicStringHash.h> > > namespace WebCore { > > class MutationCallback; >+class MutationObserverRegistration; > class MutationRecord; > class Node; > > typedef unsigned char MutationObserverOptions; >-typedef HashSet<RefPtr<Node> > NodeHashSet; >+typedef unsigned char MutationRecordDeliveryOptions; > > class WebKitMutationObserver : public RefCounted<WebKitMutationObserver> { > public: >@@ -57,11 +58,14 @@ public: > CharacterData = 1 << 2 > }; > >- enum OptionFlags { >+ enum ObservationFlags { > Subtree = 1 << 3, >- AttributeOldValue = 1 << 4, >- CharacterDataOldValue = 1 << 5, >- AttributeFilter = 1 << 6 >+ AttributeFilter = 1 << 4 >+ }; >+ >+ enum DeliveryFlags { >+ AttributeOldValue = 1 << 5, >+ CharacterDataOldValue = 1 << 6, > }; > > static PassRefPtr<WebKitMutationObserver> create(PassRefPtr<MutationCallback>); >@@ -71,22 +75,17 @@ public: > > void observe(Node*, MutationObserverOptions); > void disconnect(); >- void willDetachNodeInObservedSubtree(PassRefPtr<Node> registrationNode, MutationObserverOptions, PassRefPtr<Node> detachingNode); >- void observedNodeDestructed(Node*); >+ void observationStarted(MutationObserverRegistration*); >+ void observationEnded(MutationObserverRegistration*); > void enqueueMutationRecord(PassRefPtr<MutationRecord>); > > private: > WebKitMutationObserver(PassRefPtr<MutationCallback>); >- >- void clearAllTransientObservations(); > void deliver(); > > RefPtr<MutationCallback> m_callback; > Vector<RefPtr<MutationRecord> > m_records; >- Vector<Node*> m_observedNodes; // NodeRareData has a RefPtr to this, so use a weak pointer to avoid a cycle. >- >- // FIXME: Change this to be OwnPtr<NodeHashSet> when OwnPtr supports being contained as map values. >- HashMap<RefPtr<Node>, NodeHashSet*> m_transientObservedNodes; >+ HashSet<MutationObserverRegistration*> m_registrations; // Back-pointers to registrations which are holding references to this observer. > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71577
:
113690
|
113724
|
113728