Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: Source/core/frame/PlatformEventDispatcher.cpp

Issue 619383002: Move PlatformEventDispatcher implementations to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix non-Oilpan allocation of DeviceLightDispatcher singleton Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/PlatformEventDispatcher.h ('k') | Source/modules/battery/BatteryDispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/PlatformEventDispatcher.cpp
diff --git a/Source/core/frame/PlatformEventDispatcher.cpp b/Source/core/frame/PlatformEventDispatcher.cpp
index 397d7881752d3dd435ddd6410d8a191368f72f71..7cd841e00d7a87728bffd415ab82efba4cfaab70 100644
--- a/Source/core/frame/PlatformEventDispatcher.cpp
+++ b/Source/core/frame/PlatformEventDispatcher.cpp
@@ -16,10 +16,6 @@ PlatformEventDispatcher::PlatformEventDispatcher()
{
}
-PlatformEventDispatcher::~PlatformEventDispatcher()
-{
-}
-
void PlatformEventDispatcher::addController(PlatformEventController* controller)
{
bool wasEmpty = m_controllers.isEmpty();
@@ -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
« no previous file with comments | « Source/core/frame/PlatformEventDispatcher.h ('k') | Source/modules/battery/BatteryDispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698