| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 for (size_t i = 0; i < size; ++i) { | 73 for (size_t i = 0; i < size; ++i) { |
| 74 if (m_controllers[i]) | 74 if (m_controllers[i]) |
| 75 m_controllers[i]->didUpdateData(); | 75 m_controllers[i]->didUpdateData(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (m_needsPurge) | 79 if (m_needsPurge) |
| 80 purgeControllers(); | 80 purgeControllers(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void PlatformEventDispatcher::trace(Visitor* visitor) | 83 DEFINE_TRACE(PlatformEventDispatcher) |
| 84 { | 84 { |
| 85 #if ENABLE(OILPAN) | 85 #if ENABLE(OILPAN) |
| 86 // Trace the backing store, the weak(&bare) element references won't be. | 86 // Trace the backing store, the weak(&bare) element references won't be. |
| 87 visitor->trace(m_controllers); | 87 visitor->trace(m_controllers); |
| 88 visitor->registerWeakMembers<PlatformEventDispatcher, &PlatformEventDispatch
er::clearWeakMembers>(this); | 88 visitor->template registerWeakMembers<PlatformEventDispatcher, &PlatformEven
tDispatcher::clearWeakMembers>(this); |
| 89 #endif | 89 #endif |
| 90 } | 90 } |
| 91 | 91 |
| 92 #if ENABLE(OILPAN) | 92 #if ENABLE(OILPAN) |
| 93 void PlatformEventDispatcher::clearWeakMembers(Visitor* visitor) | 93 void PlatformEventDispatcher::clearWeakMembers(Visitor* visitor) |
| 94 { | 94 { |
| 95 for (size_t i = 0; i < m_controllers.size(); ++i) { | 95 for (size_t i = 0; i < m_controllers.size(); ++i) { |
| 96 if (!visitor->isAlive(m_controllers[i])) { | 96 if (!visitor->isAlive(m_controllers[i])) { |
| 97 m_controllers[i] = nullptr; | 97 m_controllers[i] = nullptr; |
| 98 m_needsPurge = true; | 98 m_needsPurge = true; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 // Next notification will purge the empty slots. | 101 // Next notification will purge the empty slots. |
| 102 } | 102 } |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |