summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ChildListMutationScope.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ChildListMutationScope.h')
-rw-r--r--Source/WebCore/dom/ChildListMutationScope.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/WebCore/dom/ChildListMutationScope.h b/Source/WebCore/dom/ChildListMutationScope.h
index a179f59b7..945aad5e3 100644
--- a/Source/WebCore/dom/ChildListMutationScope.h
+++ b/Source/WebCore/dom/ChildListMutationScope.h
@@ -28,15 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ChildListMutationScope_h
-#define ChildListMutationScope_h
+#pragma once
#include "Document.h"
#include "MutationObserver.h"
#include "Node.h"
-#include <wtf/HashMap.h>
+#include <memory>
#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -46,16 +44,16 @@ class MutationObserverInterestGroup;
// ChildListMutationAccumulator is not meant to be used directly; ChildListMutationScope is the public interface.
class ChildListMutationAccumulator : public RefCounted<ChildListMutationAccumulator> {
public:
- static PassRefPtr<ChildListMutationAccumulator> getOrCreate(ContainerNode&);
+ static RefPtr<ChildListMutationAccumulator> getOrCreate(ContainerNode&);
~ChildListMutationAccumulator();
void childAdded(Node&);
void willRemoveChild(Node&);
- bool hasObservers() const { return m_observers; }
+ bool hasObservers() const { return !!m_observers; }
private:
- ChildListMutationAccumulator(ContainerNode&, PassOwnPtr<MutationObserverInterestGroup>);
+ ChildListMutationAccumulator(ContainerNode&, std::unique_ptr<MutationObserverInterestGroup>);
void enqueueMutationRecord();
bool isEmpty();
@@ -70,7 +68,7 @@ private:
RefPtr<Node> m_nextSibling;
Node* m_lastAdded;
- OwnPtr<MutationObserverInterestGroup> m_observers;
+ std::unique_ptr<MutationObserverInterestGroup> m_observers;
};
class ChildListMutationScope {
@@ -82,6 +80,8 @@ public:
m_accumulator = ChildListMutationAccumulator::getOrCreate(target);
}
+ bool canObserve() const { return m_accumulator; }
+
void childAdded(Node& child)
{
if (m_accumulator && m_accumulator->hasObservers())
@@ -99,5 +99,3 @@ private:
};
} // namespace WebCore
-
-#endif // ChildListMutationScope_h