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

Unified Diff: Source/core/inspector/InjectedScriptManager.cpp

Issue 1040703002: Oilpan: avoid InjectedScriptManager::CallbackData-induced leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add explicit dispose() Created 5 years, 9 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/inspector/InjectedScriptManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptManager.cpp
diff --git a/Source/core/inspector/InjectedScriptManager.cpp b/Source/core/inspector/InjectedScriptManager.cpp
index be69c72baf3d0bc136772fc807ca87648d82f49e..7cb1ac0dc3013df2866de8bf2436dd756bd1e390 100644
--- a/Source/core/inspector/InjectedScriptManager.cpp
+++ b/Source/core/inspector/InjectedScriptManager.cpp
@@ -68,6 +68,9 @@ InjectedScriptManager::~InjectedScriptManager()
DEFINE_TRACE(InjectedScriptManager)
{
visitor->trace(m_injectedScriptHost);
+#if ENABLE(OILPAN)
+ visitor->trace(m_callbackDataSet);
+#endif
}
void InjectedScriptManager::disconnect()
@@ -185,5 +188,26 @@ InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* inspectedSc
return result;
}
-} // namespace blink
+PassOwnPtrWillBeRawPtr<InjectedScriptManager::CallbackData> InjectedScriptManager::CallbackData::create(InjectedScriptManager* manager)
+{
+ return adoptPtrWillBeNoop(new CallbackData(manager));
+}
+InjectedScriptManager::CallbackData::CallbackData(InjectedScriptManager* manager)
+ : injectedScriptManager(manager)
+{
+}
+
+void InjectedScriptManager::CallbackData::dispose()
+{
+ // Promptly release the ScopedPersistent<>.
+ handle.clear();
+}
+
+DEFINE_TRACE(InjectedScriptManager::CallbackData)
+{
+ visitor->trace(host);
+ visitor->trace(injectedScriptManager);
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/inspector/InjectedScriptManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698