OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EventHandlerRegistry_h | 5 #ifndef EventHandlerRegistry_h |
6 #define EventHandlerRegistry_h | 6 #define EventHandlerRegistry_h |
7 | 7 |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "wtf/HashCountedSet.h" | 9 #include "wtf/HashCountedSet.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void didMoveIntoFrameHost(EventTarget&); | 52 void didMoveIntoFrameHost(EventTarget&); |
53 void didMoveOutOfFrameHost(EventTarget&); | 53 void didMoveOutOfFrameHost(EventTarget&); |
54 static void didMoveBetweenFrameHosts(EventTarget&, FrameHost* oldFrameHost,
FrameHost* newFrameHost); | 54 static void didMoveBetweenFrameHosts(EventTarget&, FrameHost* oldFrameHost,
FrameHost* newFrameHost); |
55 | 55 |
56 // Either |documentDetached| or |didMove{Into,OutOf,Between}FrameHosts| must | 56 // Either |documentDetached| or |didMove{Into,OutOf,Between}FrameHosts| must |
57 // be called whenever the FrameHost that is associated with a registered eve
nt | 57 // be called whenever the FrameHost that is associated with a registered eve
nt |
58 // target changes. This ensures the registry does not end up with stale | 58 // target changes. This ensures the registry does not end up with stale |
59 // references to handlers that are no longer related to it. | 59 // references to handlers that are no longer related to it. |
60 void documentDetached(Document&); | 60 void documentDetached(Document&); |
61 | 61 |
62 void trace(Visitor*); | 62 DECLARE_TRACE(); |
63 void clearWeakMembers(Visitor*); | 63 void clearWeakMembers(Visitor*); |
64 | 64 |
65 private: | 65 private: |
66 enum ChangeOperation { | 66 enum ChangeOperation { |
67 Add, // Add a new event handler. | 67 Add, // Add a new event handler. |
68 Remove, // Remove an existing event handler. | 68 Remove, // Remove an existing event handler. |
69 RemoveAll // Remove any and all existing event handlers for a given targ
et. | 69 RemoveAll // Remove any and all existing event handlers for a given targ
et. |
70 }; | 70 }; |
71 | 71 |
72 // Returns true if |eventType| belongs to a class this registry tracks. | 72 // Returns true if |eventType| belongs to a class this registry tracks. |
(...skipping 24 matching lines...) Expand all Loading... |
97 | 97 |
98 void checkConsistency() const; | 98 void checkConsistency() const; |
99 | 99 |
100 FrameHost& m_frameHost; | 100 FrameHost& m_frameHost; |
101 EventTargetSet m_targets[EventHandlerClassCount]; | 101 EventTargetSet m_targets[EventHandlerClassCount]; |
102 }; | 102 }; |
103 | 103 |
104 } // namespace blink | 104 } // namespace blink |
105 | 105 |
106 #endif // EventHandlerRegistry_h | 106 #endif // EventHandlerRegistry_h |
OLD | NEW |