| 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 "core/frame/PlatformEventDispatcher.h" | 5 #include "core/frame/PlatformEventDispatcher.h" |
| 6 | 6 |
| 7 #include "core/frame/PlatformEventController.h" | 7 #include "core/frame/PlatformEventController.h" |
| 8 #include "wtf/TemporaryChange.h" | 8 #include "wtf/TemporaryChange.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void PlatformEventDispatcher::notifyControllers() | 45 void PlatformEventDispatcher::notifyControllers() |
| 46 { | 46 { |
| 47 if (m_controllers.isEmpty()) | 47 if (m_controllers.isEmpty()) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 { | 50 { |
| 51 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true); | 51 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true); |
| 52 // HashSet m_controllers can be updated during an iteration, and it stop
s the iteration. | 52 // HashSet m_controllers can be updated during an iteration, and it stop
s the iteration. |
| 53 // Thus we store it into a Vector to access all elements. | 53 // Thus we store it into a Vector to access all elements. |
| 54 WillBeHeapVector<RawPtrWillBeMember<PlatformEventController>> snapshotVe
ctor; | 54 HeapVector<Member<PlatformEventController>> snapshotVector; |
| 55 copyToVector(m_controllers, snapshotVector); | 55 copyToVector(m_controllers, snapshotVector); |
| 56 for (PlatformEventController* controller : snapshotVector) { | 56 for (PlatformEventController* controller : snapshotVector) { |
| 57 if (m_controllers.contains(controller)) | 57 if (m_controllers.contains(controller)) |
| 58 controller->didUpdateData(); | 58 controller->didUpdateData(); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 if (m_controllers.isEmpty()) { | 62 if (m_controllers.isEmpty()) { |
| 63 stopListening(); | 63 stopListening(); |
| 64 m_isListening = false; | 64 m_isListening = false; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 DEFINE_TRACE(PlatformEventDispatcher) | 68 DEFINE_TRACE(PlatformEventDispatcher) |
| 69 { | 69 { |
| 70 #if ENABLE(OILPAN) | 70 #if ENABLE(OILPAN) |
| 71 visitor->trace(m_controllers); | 71 visitor->trace(m_controllers); |
| 72 #endif | 72 #endif |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |