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

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

Issue 178473026: Have MutationObserverRegistration deal with references instead of pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/MutationObserver.cpp ('k') | Source/core/dom/MutationObserverRegistration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 #include "wtf/HashSet.h" 35 #include "wtf/HashSet.h"
36 #include "wtf/text/AtomicString.h" 36 #include "wtf/text/AtomicString.h"
37 #include "wtf/text/AtomicStringHash.h" 37 #include "wtf/text/AtomicStringHash.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 class QualifiedName; 41 class QualifiedName;
42 42
43 class MutationObserverRegistration { 43 class MutationObserverRegistration {
44 public: 44 public:
45 static PassOwnPtr<MutationObserverRegistration> create(PassRefPtr<MutationOb server>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeF ilter); 45 static PassOwnPtr<MutationObserverRegistration> create(MutationObserver&, No de&, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
46 ~MutationObserverRegistration(); 46 ~MutationObserverRegistration();
47 47
48 void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter); 48 void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
49 void observedSubtreeNodeWillDetach(Node*); 49 void observedSubtreeNodeWillDetach(Node&);
50 void clearTransientRegistrations(); 50 void clearTransientRegistrations();
51 bool hasTransientRegistrations() const { return m_transientRegistrationNodes && !m_transientRegistrationNodes->isEmpty(); } 51 bool hasTransientRegistrations() const { return m_transientRegistrationNodes && !m_transientRegistrationNodes->isEmpty(); }
52 void unregister(); 52 void unregister();
53 53
54 bool shouldReceiveMutationFrom(Node*, MutationObserver::MutationType, const QualifiedName* attributeName) const; 54 bool shouldReceiveMutationFrom(Node&, MutationObserver::MutationType, const QualifiedName* attributeName) const;
55 bool isSubtree() const { return m_options & MutationObserver::Subtree; } 55 bool isSubtree() const { return m_options & MutationObserver::Subtree; }
56 56
57 MutationObserver* observer() const { return m_observer.get(); } 57 MutationObserver& observer() const { return *m_observer; }
58 MutationRecordDeliveryOptions deliveryOptions() const { return m_options & ( MutationObserver::AttributeOldValue | MutationObserver::CharacterDataOldValue); } 58 MutationRecordDeliveryOptions deliveryOptions() const { return m_options & ( MutationObserver::AttributeOldValue | MutationObserver::CharacterDataOldValue); }
59 MutationObserverOptions mutationTypes() const { return m_options & MutationO bserver::AllMutationTypes; } 59 MutationObserverOptions mutationTypes() const { return m_options & MutationO bserver::AllMutationTypes; }
60 60
61 void addRegistrationNodesToSet(HashSet<Node*>&) const; 61 void addRegistrationNodesToSet(HashSet<Node*>&) const;
62 62
63 private: 63 private:
64 MutationObserverRegistration(PassRefPtr<MutationObserver>, Node*, MutationOb serverOptions, const HashSet<AtomicString>& attributeFilter); 64 MutationObserverRegistration(MutationObserver&, Node&, MutationObserverOptio ns, const HashSet<AtomicString>& attributeFilter);
65 65
66 RefPtr<MutationObserver> m_observer; 66 RefPtr<MutationObserver> m_observer;
67 Node* m_registrationNode; 67 Node& m_registrationNode;
68 RefPtr<Node> m_registrationNodeKeepAlive; 68 RefPtr<Node> m_registrationNodeKeepAlive;
69 typedef HashSet<RefPtr<Node> > NodeHashSet; 69 typedef HashSet<RefPtr<Node> > NodeHashSet;
70 OwnPtr<NodeHashSet> m_transientRegistrationNodes; 70 OwnPtr<NodeHashSet> m_transientRegistrationNodes;
71 71
72 MutationObserverOptions m_options; 72 MutationObserverOptions m_options;
73 HashSet<AtomicString> m_attributeFilter; 73 HashSet<AtomicString> m_attributeFilter;
74 }; 74 };
75 75
76 } // namespace WebCore 76 } // namespace WebCore
77 77
78 #endif // MutationObserverRegistration_h 78 #endif // MutationObserverRegistration_h
OLDNEW
« no previous file with comments | « Source/core/dom/MutationObserver.cpp ('k') | Source/core/dom/MutationObserverRegistration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698