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

Unified Diff: Source/web/WebDevToolsAgentImpl.cpp

Issue 996163002: Add an explicit dispose step for WebDevToolsAgentImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/web/WebDevToolsAgentImpl.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebDevToolsAgentImpl.cpp
diff --git a/Source/web/WebDevToolsAgentImpl.cpp b/Source/web/WebDevToolsAgentImpl.cpp
index 20a7784dfa537bee98dbc0e82b4187154cd998ca..79082e21305e2b3303467a77cd134189c9057e63 100644
--- a/Source/web/WebDevToolsAgentImpl.cpp
+++ b/Source/web/WebDevToolsAgentImpl.cpp
@@ -231,6 +231,9 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
: m_client(client)
, m_webViewImpl(webViewImpl)
, m_attached(false)
+#if ENABLE(ASSERT)
+ , m_hasBeenDisposed(false)
+#endif
, m_instrumentingAgents(webViewImpl->page()->instrumentingAgents())
, m_injectedScriptManager(InjectedScriptManager::createForPage())
, m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this)))
@@ -304,10 +307,21 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
WebDevToolsAgentImpl::~WebDevToolsAgentImpl()
{
+ ASSERT(m_hasBeenDisposed);
+}
+
+void WebDevToolsAgentImpl::dispose()
+{
+ // Explicitly dispose of the agent before destructing to ensure
+ // same behavior (and correctness) with and without Oilpan.
ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl);
m_webViewImpl->settingsImpl()->setWebDevToolsAgentImpl(nullptr);
if (m_attached)
Platform::current()->currentThread()->removeTaskObserver(this);
+#if ENABLE(ASSERT)
+ ASSERT(!m_hasBeenDisposed);
+ m_hasBeenDisposed = true;
+#endif
}
DEFINE_TRACE(WebDevToolsAgentImpl)
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698