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 #include "config.h" | 5 #include "config.h" |
6 #include "core/frame/PlatformEventDispatcher.h" | 6 #include "core/frame/PlatformEventDispatcher.h" |
7 | 7 |
8 #include "core/frame/PlatformEventController.h" | 8 #include "core/frame/PlatformEventController.h" |
9 #include "wtf/TemporaryChange.h" | 9 #include "wtf/TemporaryChange.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 PlatformEventDispatcher::PlatformEventDispatcher() | 13 PlatformEventDispatcher::PlatformEventDispatcher() |
14 : m_isDispatching(false) | 14 : m_isDispatching(false) |
15 , m_isListening(false) | 15 , m_isListening(false) |
16 { | 16 { |
17 } | 17 } |
18 | 18 |
19 void PlatformEventDispatcher::addController(PlatformEventController* controller) | 19 void PlatformEventDispatcher::addController(PlatformEventController* controller) |
20 { | 20 { |
21 ASSERT(controller); | 21 ASSERT(controller); |
22 ASSERT(!m_controllers.contains(controller)); | |
23 | 22 |
24 m_controllers.add(controller); | 23 // FIXME: If we can avoid registering a controller twice, we can change |
haraken
2015/09/04 05:32:45
FIXME => TODO
peria
2015/09/04 05:41:18
Done.
| |
24 // this 'if' to ASSERT. | |
25 if (!m_controllers.contains(controller)) | |
haraken
2015/09/04 05:32:45
Would't it be better to early-return if the contro
peria
2015/09/04 05:41:18
Done.
| |
26 m_controllers.add(controller); | |
27 | |
25 if (!m_isListening) { | 28 if (!m_isListening) { |
26 startListening(); | 29 startListening(); |
27 m_isListening = true; | 30 m_isListening = true; |
28 } | 31 } |
29 } | 32 } |
30 | 33 |
31 void PlatformEventDispatcher::removeController(PlatformEventController* controll er) | 34 void PlatformEventDispatcher::removeController(PlatformEventController* controll er) |
32 { | 35 { |
33 ASSERT(m_controllers.contains(controller)); | 36 ASSERT(m_controllers.contains(controller)); |
34 | 37 |
(...skipping 28 matching lines...) Expand all Loading... | |
63 } | 66 } |
64 | 67 |
65 DEFINE_TRACE(PlatformEventDispatcher) | 68 DEFINE_TRACE(PlatformEventDispatcher) |
66 { | 69 { |
67 #if ENABLE(OILPAN) | 70 #if ENABLE(OILPAN) |
68 visitor->trace(m_controllers); | 71 visitor->trace(m_controllers); |
69 #endif | 72 #endif |
70 } | 73 } |
71 | 74 |
72 } // namespace blink | 75 } // namespace blink |
OLD | NEW |