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

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

Issue 560003002: Add MutationObserverInit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/MutationObserver.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 28 matching lines...) Expand all
39 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 #include "wtf/Vector.h" 41 #include "wtf/Vector.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class Dictionary; 45 class Dictionary;
46 class ExceptionState; 46 class ExceptionState;
47 class MutationCallback; 47 class MutationCallback;
48 class MutationObserver; 48 class MutationObserver;
49 class MutationObserverInit;
49 class MutationObserverRegistration; 50 class MutationObserverRegistration;
50 class MutationRecord; 51 class MutationRecord;
51 class Node; 52 class Node;
52 53
53 typedef unsigned char MutationObserverOptions; 54 typedef unsigned char MutationObserverOptions;
54 typedef unsigned char MutationRecordDeliveryOptions; 55 typedef unsigned char MutationRecordDeliveryOptions;
55 56
56 typedef WillBeHeapHashSet<RefPtrWillBeMember<MutationObserver> > MutationObserve rSet; 57 typedef WillBeHeapHashSet<RefPtrWillBeMember<MutationObserver> > MutationObserve rSet;
57 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<MutationObserverRegistration> > MutationObserverRegistrationSet; 58 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<MutationObserverRegistration> > MutationObserverRegistrationSet;
58 typedef WillBeHeapVector<RefPtrWillBeMember<MutationObserver> > MutationObserver Vector; 59 typedef WillBeHeapVector<RefPtrWillBeMember<MutationObserver> > MutationObserver Vector;
(...skipping 19 matching lines...) Expand all
78 AttributeOldValue = 1 << 5, 79 AttributeOldValue = 1 << 5,
79 CharacterDataOldValue = 1 << 6, 80 CharacterDataOldValue = 1 << 6,
80 }; 81 };
81 82
82 static PassRefPtrWillBeRawPtr<MutationObserver> create(PassOwnPtr<MutationCa llback>); 83 static PassRefPtrWillBeRawPtr<MutationObserver> create(PassOwnPtr<MutationCa llback>);
83 static void resumeSuspendedObservers(); 84 static void resumeSuspendedObservers();
84 static void deliverMutations(); 85 static void deliverMutations();
85 86
86 ~MutationObserver(); 87 ~MutationObserver();
87 88
88 void observe(Node*, const Dictionary&, ExceptionState&); 89 void observe(Node*, const MutationObserverInit&, ExceptionState&);
89 WillBeHeapVector<RefPtrWillBeMember<MutationRecord> > takeRecords(); 90 WillBeHeapVector<RefPtrWillBeMember<MutationRecord> > takeRecords();
90 void disconnect(); 91 void disconnect();
91 void observationStarted(MutationObserverRegistration*); 92 void observationStarted(MutationObserverRegistration*);
92 void observationEnded(MutationObserverRegistration*); 93 void observationEnded(MutationObserverRegistration*);
93 void enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord>); 94 void enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord>);
94 void setHasTransientRegistration(); 95 void setHasTransientRegistration();
95 bool canDeliver(); 96 bool canDeliver();
96 97
97 WillBeHeapHashSet<RawPtrWillBeMember<Node> > getObservedNodes() const; 98 WillBeHeapHashSet<RawPtrWillBeMember<Node> > getObservedNodes() const;
98 99
99 void trace(Visitor*); 100 void trace(Visitor*);
100 101
101 private: 102 private:
102 struct ObserverLessThan; 103 struct ObserverLessThan;
103 104
104 explicit MutationObserver(PassOwnPtr<MutationCallback>); 105 explicit MutationObserver(PassOwnPtr<MutationCallback>);
105 void deliver(); 106 void deliver();
106 107
107 OwnPtr<MutationCallback> m_callback; 108 OwnPtr<MutationCallback> m_callback;
108 MutationRecordVector m_records; 109 MutationRecordVector m_records;
109 MutationObserverRegistrationSet m_registrations; 110 MutationObserverRegistrationSet m_registrations;
110 unsigned m_priority; 111 unsigned m_priority;
111 }; 112 };
112 113
113 } // namespace blink 114 } // namespace blink
114 115
115 #endif // MutationObserver_h 116 #endif // MutationObserver_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698