Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: Source/core/dom/MutationObserverRegistration.h

Issue 236653002: Oilpan: move mutation observers to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + explicitly dispose() mutation observer registrations always (non-Oilpan also.) Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef MutationObserverRegistration_h 31 #ifndef MutationObserverRegistration_h
32 #define MutationObserverRegistration_h 32 #define MutationObserverRegistration_h
33 33
34 #include "core/dom/MutationObserver.h" 34 #include "core/dom/MutationObserver.h"
35 #include "platform/heap/Handle.h"
35 #include "wtf/HashSet.h" 36 #include "wtf/HashSet.h"
36 #include "wtf/text/AtomicString.h" 37 #include "wtf/text/AtomicString.h"
37 #include "wtf/text/AtomicStringHash.h" 38 #include "wtf/text/AtomicStringHash.h"
38 39
39 namespace WebCore { 40 namespace WebCore {
40 41
41 class QualifiedName; 42 class QualifiedName;
42 43
43 class MutationObserverRegistration { 44 class MutationObserverRegistration FINAL : public NoBaseWillBeGarbageCollectedFi nalized<MutationObserverRegistration> {
44 public: 45 public:
45 static PassOwnPtr<MutationObserverRegistration> create(MutationObserver&, No de&, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter); 46 static PassOwnPtrWillBeRawPtr<MutationObserverRegistration> create(MutationO bserver&, Node&, MutationObserverOptions, const HashSet<AtomicString>& attribute Filter);
46 ~MutationObserverRegistration(); 47 ~MutationObserverRegistration();
47 48
48 void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter); 49 void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
49 void observedSubtreeNodeWillDetach(Node&); 50 void observedSubtreeNodeWillDetach(Node&);
50 void clearTransientRegistrations(); 51 void clearTransientRegistrations();
51 bool hasTransientRegistrations() const { return m_transientRegistrationNodes && !m_transientRegistrationNodes->isEmpty(); } 52 bool hasTransientRegistrations() const { return m_transientRegistrationNodes && !m_transientRegistrationNodes->isEmpty(); }
52 void unregister(); 53 void unregister();
53 54
54 bool shouldReceiveMutationFrom(Node&, MutationObserver::MutationType, const QualifiedName* attributeName) const; 55 bool shouldReceiveMutationFrom(Node&, MutationObserver::MutationType, const QualifiedName* attributeName) const;
55 bool isSubtree() const { return m_options & MutationObserver::Subtree; } 56 bool isSubtree() const { return m_options & MutationObserver::Subtree; }
56 57
57 MutationObserver& observer() const { return *m_observer; } 58 MutationObserver& observer() const { return *m_observer; }
58 MutationRecordDeliveryOptions deliveryOptions() const { return m_options & ( MutationObserver::AttributeOldValue | MutationObserver::CharacterDataOldValue); } 59 MutationRecordDeliveryOptions deliveryOptions() const { return m_options & ( MutationObserver::AttributeOldValue | MutationObserver::CharacterDataOldValue); }
59 MutationObserverOptions mutationTypes() const { return m_options & MutationO bserver::AllMutationTypes; } 60 MutationObserverOptions mutationTypes() const { return m_options & MutationO bserver::AllMutationTypes; }
60 61
61 void addRegistrationNodesToSet(HashSet<Node*>&) const; 62 void addRegistrationNodesToSet(HashSet<Node*>&) const;
62 63
64 void trace(Visitor*);
65
66 void dispose();
67
63 private: 68 private:
64 MutationObserverRegistration(MutationObserver&, Node&, MutationObserverOptio ns, const HashSet<AtomicString>& attributeFilter); 69 MutationObserverRegistration(MutationObserver&, Node&, MutationObserverOptio ns, const HashSet<AtomicString>& attributeFilter);
65 70
66 RefPtr<MutationObserver> m_observer; 71 RefPtrWillBeMember<MutationObserver> m_observer;
67 Node& m_registrationNode; 72 Node& m_registrationNode;
68 RefPtr<Node> m_registrationNodeKeepAlive; 73 RefPtr<Node> m_registrationNodeKeepAlive;
69 typedef HashSet<RefPtr<Node> > NodeHashSet; 74 typedef HashSet<RefPtr<Node> > NodeHashSet;
70 OwnPtr<NodeHashSet> m_transientRegistrationNodes; 75 OwnPtr<NodeHashSet> m_transientRegistrationNodes;
71 76
72 MutationObserverOptions m_options; 77 MutationObserverOptions m_options;
73 HashSet<AtomicString> m_attributeFilter; 78 HashSet<AtomicString> m_attributeFilter;
74 }; 79 };
75 80
76 } // namespace WebCore 81 } // namespace WebCore
77 82
78 #endif // MutationObserverRegistration_h 83 #endif // MutationObserverRegistration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698