Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / PlatformEventDispatcher.cpp
index 40267d3..7cd841e 100644 (file)
@@ -16,10 +16,6 @@ PlatformEventDispatcher::PlatformEventDispatcher()
 {
 }
 
-PlatformEventDispatcher::~PlatformEventDispatcher()
-{
-}
-
 void PlatformEventDispatcher::addController(PlatformEventController* controller)
 {
     bool wasEmpty = m_controllers.isEmpty();
@@ -41,7 +37,7 @@ void PlatformEventDispatcher::removeController(PlatformEventController* controll
     if (index == kNotFound)
         return;
 
-    m_controllers[index] = 0;
+    m_controllers[index] = nullptr;
     m_needsPurge = true;
 
     if (!m_isDispatching)
@@ -84,4 +80,26 @@ void PlatformEventDispatcher::notifyControllers()
         purgeControllers();
 }
 
+void PlatformEventDispatcher::trace(Visitor* visitor)
+{
+#if ENABLE(OILPAN)
+    // Trace the backing store, the weak(&bare) element references won't be.
+    visitor->trace(m_controllers);
+    visitor->registerWeakMembers<PlatformEventDispatcher, &PlatformEventDispatcher::clearWeakMembers>(this);
+#endif
+}
+
+#if ENABLE(OILPAN)
+void PlatformEventDispatcher::clearWeakMembers(Visitor* visitor)
+{
+    for (size_t i = 0; i < m_controllers.size(); ++i) {
+        if (!visitor->isAlive(m_controllers[i])) {
+            m_controllers[i] = nullptr;
+            m_needsPurge = true;
+        }
+    }
+    // Next notification will purge the empty slots.
+}
+#endif
+
 } // namespace blink