Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / MutationObserver.h
index 086e600..1986678 100644 (file)
@@ -31,7 +31,8 @@
 #ifndef MutationObserver_h
 #define MutationObserver_h
 
-#include "bindings/v8/ScriptWrappable.h"
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "platform/heap/Handle.h"
 #include "wtf/HashSet.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
-namespace WebCore {
+namespace blink {
 
 class Dictionary;
 class ExceptionState;
 class MutationCallback;
+class MutationObserver;
+class MutationObserverInit;
 class MutationObserverRegistration;
 class MutationRecord;
 class Node;
@@ -51,7 +54,13 @@ class Node;
 typedef unsigned char MutationObserverOptions;
 typedef unsigned char MutationRecordDeliveryOptions;
 
-class MutationObserver : public RefCounted<MutationObserver>, public ScriptWrappable {
+typedef WillBeHeapHashSet<RefPtrWillBeMember<MutationObserver> > MutationObserverSet;
+typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<MutationObserverRegistration> > MutationObserverRegistrationSet;
+typedef WillBeHeapVector<RefPtrWillBeMember<MutationObserver> > MutationObserverVector;
+typedef WillBeHeapVector<RefPtrWillBeMember<MutationRecord> > MutationRecordVector;
+
+class MutationObserver final : public RefCountedWillBeGarbageCollectedFinalized<MutationObserver>, public ScriptWrappable {
+    DEFINE_WRAPPERTYPEINFO();
 public:
     enum MutationType {
         ChildList = 1 << 0,
@@ -71,35 +80,37 @@ public:
         CharacterDataOldValue = 1 << 6,
     };
 
-    static PassRefPtr<MutationObserver> create(PassOwnPtr<MutationCallback>);
+    static PassRefPtrWillBeRawPtr<MutationObserver> create(PassOwnPtr<MutationCallback>);
     static void resumeSuspendedObservers();
     static void deliverMutations();
 
     ~MutationObserver();
 
-    void observe(Node*, const Dictionary&, ExceptionState&);
-    Vector<RefPtr<MutationRecord> > takeRecords();
+    void observe(Node*, const MutationObserverInit&, ExceptionState&);
+    WillBeHeapVector<RefPtrWillBeMember<MutationRecord> > takeRecords();
     void disconnect();
     void observationStarted(MutationObserverRegistration*);
     void observationEnded(MutationObserverRegistration*);
-    void enqueueMutationRecord(PassRefPtr<MutationRecord>);
+    void enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord>);
     void setHasTransientRegistration();
-    bool canDeliver();
 
-    HashSet<Node*> getObservedNodes() const;
+    WillBeHeapHashSet<RawPtrWillBeMember<Node> > getObservedNodes() const;
+
+    void trace(Visitor*);
 
 private:
     struct ObserverLessThan;
 
     explicit MutationObserver(PassOwnPtr<MutationCallback>);
     void deliver();
+    bool shouldBeSuspended() const;
 
     OwnPtr<MutationCallback> m_callback;
-    Vector<RefPtr<MutationRecord> > m_records;
-    HashSet<MutationObserverRegistration*> m_registrations;
+    MutationRecordVector m_records;
+    MutationObserverRegistrationSet m_registrations;
     unsigned m_priority;
 };
 
-}
+} // namespace blink
 
 #endif // MutationObserver_h