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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 private: 224 private:
225 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; 225 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor;
226 }; 226 };
227 227
228 WebDevToolsAgentImpl::WebDevToolsAgentImpl( 228 WebDevToolsAgentImpl::WebDevToolsAgentImpl(
229 WebViewImpl* webViewImpl, 229 WebViewImpl* webViewImpl,
230 WebDevToolsAgentClient* client) 230 WebDevToolsAgentClient* client)
231 : m_client(client) 231 : m_client(client)
232 , m_webViewImpl(webViewImpl) 232 , m_webViewImpl(webViewImpl)
233 , m_attached(false) 233 , m_attached(false)
234 #if ENABLE(ASSERT)
235 , m_hasBeenDisposed(false)
236 #endif
234 , m_instrumentingAgents(webViewImpl->page()->instrumentingAgents()) 237 , m_instrumentingAgents(webViewImpl->page()->instrumentingAgents())
235 , m_injectedScriptManager(InjectedScriptManager::createForPage()) 238 , m_injectedScriptManager(InjectedScriptManager::createForPage())
236 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this))) 239 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this)))
237 , m_overlay(InspectorOverlay::create(webViewImpl->page(), this)) 240 , m_overlay(InspectorOverlay::create(webViewImpl->page(), this))
238 , m_cssAgent(nullptr) 241 , m_cssAgent(nullptr)
239 , m_resourceAgent(nullptr) 242 , m_resourceAgent(nullptr)
240 , m_layerTreeAgent(nullptr) 243 , m_layerTreeAgent(nullptr)
241 , m_agents(m_instrumentingAgents.get(), m_state.get()) 244 , m_agents(m_instrumentingAgents.get(), m_state.get())
242 , m_deferredAgentsInitialized(false) 245 , m_deferredAgentsInitialized(false)
243 , m_generatingEvent(false) 246 , m_generatingEvent(false)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 m_agents.append(InspectorIndexedDBAgent::create(page)); 300 m_agents.append(InspectorIndexedDBAgent::create(page));
298 m_agents.append(InspectorAccessibilityAgent::create(page)); 301 m_agents.append(InspectorAccessibilityAgent::create(page));
299 m_agents.append(InspectorDOMStorageAgent::create(page)); 302 m_agents.append(InspectorDOMStorageAgent::create(page));
300 303
301 m_webViewImpl->settingsImpl()->setWebDevToolsAgentImpl(this); 304 m_webViewImpl->settingsImpl()->setWebDevToolsAgentImpl(this);
302 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); 305 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client);
303 } 306 }
304 307
305 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() 308 WebDevToolsAgentImpl::~WebDevToolsAgentImpl()
306 { 309 {
310 ASSERT(m_hasBeenDisposed);
311 }
312
313 void WebDevToolsAgentImpl::dispose()
314 {
315 // Explicitly dispose of the agent before destructing to ensure
316 // same behavior (and correctness) with and without Oilpan.
307 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); 317 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl);
308 m_webViewImpl->settingsImpl()->setWebDevToolsAgentImpl(nullptr); 318 m_webViewImpl->settingsImpl()->setWebDevToolsAgentImpl(nullptr);
309 if (m_attached) 319 if (m_attached)
310 Platform::current()->currentThread()->removeTaskObserver(this); 320 Platform::current()->currentThread()->removeTaskObserver(this);
321 #if ENABLE(ASSERT)
322 ASSERT(!m_hasBeenDisposed);
323 m_hasBeenDisposed = true;
324 #endif
311 } 325 }
312 326
313 DEFINE_TRACE(WebDevToolsAgentImpl) 327 DEFINE_TRACE(WebDevToolsAgentImpl)
314 { 328 {
315 visitor->trace(m_instrumentingAgents); 329 visitor->trace(m_instrumentingAgents);
316 visitor->trace(m_injectedScriptManager); 330 visitor->trace(m_injectedScriptManager);
317 visitor->trace(m_state); 331 visitor->trace(m_state);
318 visitor->trace(m_overlay); 332 visitor->trace(m_overlay);
319 visitor->trace(m_asyncCallTracker); 333 visitor->trace(m_asyncCallTracker);
320 visitor->trace(m_domAgent); 334 visitor->trace(m_domAgent);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) 901 if (!InspectorBackendDispatcher::getCommandName(message, &commandName))
888 return false; 902 return false;
889 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd) 903 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd)
890 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd) 904 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd)
891 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd) 905 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd)
892 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 906 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
893 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 907 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
894 } 908 }
895 909
896 } // namespace blink 910 } // namespace blink
OLDNEW
« 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