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) |