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 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Do not actually remove the controller from the vector, instead zero them
out. | 34 // Do not actually remove the controller from the vector, instead zero them
out. |
35 // The zeros are removed in these two cases: | 35 // The zeros are removed in these two cases: |
36 // 1. either immediately if we are not dispatching any events, | 36 // 1. either immediately if we are not dispatching any events, |
37 // 2. or after events to all controllers have dispatched (see notifyControll
ers()). | 37 // 2. or after events to all controllers have dispatched (see notifyControll
ers()). |
38 // This is to correctly handle the re-entrancy case when a controller is des
troyed | 38 // This is to correctly handle the re-entrancy case when a controller is des
troyed |
39 // while the events are still being dispatched. | 39 // while the events are still being dispatched. |
40 size_t index = m_controllers.find(controller); | 40 size_t index = m_controllers.find(controller); |
41 if (index == kNotFound) | 41 if (index == kNotFound) |
42 return; | 42 return; |
43 | 43 |
44 m_controllers[index] = 0; | 44 m_controllers[index] = nullptr; |
45 m_needsPurge = true; | 45 m_needsPurge = true; |
46 | 46 |
47 if (!m_isDispatching) | 47 if (!m_isDispatching) |
48 purgeControllers(); | 48 purgeControllers(); |
49 } | 49 } |
50 | 50 |
51 void PlatformEventDispatcher::purgeControllers() | 51 void PlatformEventDispatcher::purgeControllers() |
52 { | 52 { |
53 ASSERT(m_needsPurge); | 53 ASSERT(m_needsPurge); |
54 | 54 |
(...skipping 23 matching lines...) Expand all Loading... |
78 if (m_controllers[i]) | 78 if (m_controllers[i]) |
79 m_controllers[i]->didUpdateData(); | 79 m_controllers[i]->didUpdateData(); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 if (m_needsPurge) | 83 if (m_needsPurge) |
84 purgeControllers(); | 84 purgeControllers(); |
85 } | 85 } |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
OLD | NEW |