OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |