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

Side by Side Diff: Source/web/WebDevToolsAgentImpl.cpp

Issue 1315283002: [DevTools] Reverse dependencies between InspectorOverlay and agents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more compile Created 5 years, 3 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') | no next file » | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "core/inspector/InspectorCSSAgent.h" 47 #include "core/inspector/InspectorCSSAgent.h"
48 #include "core/inspector/InspectorDOMAgent.h" 48 #include "core/inspector/InspectorDOMAgent.h"
49 #include "core/inspector/InspectorDOMDebuggerAgent.h" 49 #include "core/inspector/InspectorDOMDebuggerAgent.h"
50 #include "core/inspector/InspectorDebuggerAgent.h" 50 #include "core/inspector/InspectorDebuggerAgent.h"
51 #include "core/inspector/InspectorHeapProfilerAgent.h" 51 #include "core/inspector/InspectorHeapProfilerAgent.h"
52 #include "core/inspector/InspectorInputAgent.h" 52 #include "core/inspector/InspectorInputAgent.h"
53 #include "core/inspector/InspectorInspectorAgent.h" 53 #include "core/inspector/InspectorInspectorAgent.h"
54 #include "core/inspector/InspectorInstrumentation.h" 54 #include "core/inspector/InspectorInstrumentation.h"
55 #include "core/inspector/InspectorLayerTreeAgent.h" 55 #include "core/inspector/InspectorLayerTreeAgent.h"
56 #include "core/inspector/InspectorMemoryAgent.h" 56 #include "core/inspector/InspectorMemoryAgent.h"
57 #include "core/inspector/InspectorOverlay.h"
58 #include "core/inspector/InspectorPageAgent.h" 57 #include "core/inspector/InspectorPageAgent.h"
59 #include "core/inspector/InspectorProfilerAgent.h" 58 #include "core/inspector/InspectorProfilerAgent.h"
60 #include "core/inspector/InspectorResourceAgent.h" 59 #include "core/inspector/InspectorResourceAgent.h"
61 #include "core/inspector/InspectorResourceContentLoader.h" 60 #include "core/inspector/InspectorResourceContentLoader.h"
62 #include "core/inspector/InspectorState.h" 61 #include "core/inspector/InspectorState.h"
63 #include "core/inspector/InspectorTaskRunner.h" 62 #include "core/inspector/InspectorTaskRunner.h"
64 #include "core/inspector/InspectorTimelineAgent.h" 63 #include "core/inspector/InspectorTimelineAgent.h"
65 #include "core/inspector/InspectorTracingAgent.h" 64 #include "core/inspector/InspectorTracingAgent.h"
66 #include "core/inspector/InspectorWorkerAgent.h" 65 #include "core/inspector/InspectorWorkerAgent.h"
67 #include "core/inspector/InstrumentingAgents.h" 66 #include "core/inspector/InstrumentingAgents.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 private: 274 private:
276 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; 275 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor;
277 }; 276 };
278 277
279 // static 278 // static
280 PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLoc alFrameImpl* frame, WebDevToolsAgentClient* client) 279 PassOwnPtrWillBeRawPtr<WebDevToolsAgentImpl> WebDevToolsAgentImpl::create(WebLoc alFrameImpl* frame, WebDevToolsAgentClient* client)
281 { 280 {
282 WebViewImpl* view = frame->viewImpl(); 281 WebViewImpl* view = frame->viewImpl();
283 bool isMainFrame = view && view->mainFrameImpl() == frame; 282 bool isMainFrame = view && view->mainFrameImpl() == frame;
284 if (!isMainFrame) { 283 if (!isMainFrame) {
285 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, In spectorOverlayImpl::createEmpty()); 284 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, nu llptr);
286 if (frame->frameWidget()) 285 if (frame->frameWidget())
287 agent->layerTreeViewChanged(toWebFrameWidgetImpl(frame->frameWidget( ))->layerTreeView()); 286 agent->layerTreeViewChanged(toWebFrameWidgetImpl(frame->frameWidget( ))->layerTreeView());
288 return adoptPtrWillBeNoop(agent); 287 return adoptPtrWillBeNoop(agent);
289 } 288 }
290 289
291 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, Inspec torOverlayImpl::create(view)); 290 WebDevToolsAgentImpl* agent = new WebDevToolsAgentImpl(frame, client, Inspec torOverlayImpl::create(view));
292 agent->registerAgent(InspectorRenderingAgent::create(view)); 291 agent->registerAgent(InspectorRenderingAgent::create(view));
293 agent->registerAgent(InspectorEmulationAgent::create(view)); 292 agent->registerAgent(InspectorEmulationAgent::create(view));
294 // TODO(dgozman): migrate each of the following agents to frame once module is ready. 293 // TODO(dgozman): migrate each of the following agents to frame once module is ready.
295 agent->registerAgent(InspectorDatabaseAgent::create(view->page())); 294 agent->registerAgent(InspectorDatabaseAgent::create(view->page()));
296 agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page())); 295 agent->registerAgent(DeviceOrientationInspectorAgent::create(view->page()));
297 agent->registerAgent(InspectorFileSystemAgent::create(view->page())); 296 agent->registerAgent(InspectorFileSystemAgent::create(view->page()));
298 agent->registerAgent(InspectorIndexedDBAgent::create(view->page())); 297 agent->registerAgent(InspectorIndexedDBAgent::create(view->page()));
299 agent->registerAgent(InspectorAccessibilityAgent::create(view->page())); 298 agent->registerAgent(InspectorAccessibilityAgent::create(view->page()));
300 agent->registerAgent(InspectorDOMStorageAgent::create(view->page())); 299 agent->registerAgent(InspectorDOMStorageAgent::create(view->page()));
301 agent->registerAgent(InspectorCacheStorageAgent::create()); 300 agent->registerAgent(InspectorCacheStorageAgent::create());
302 agent->layerTreeViewChanged(view->layerTreeView()); 301 agent->layerTreeViewChanged(view->layerTreeView());
303 return adoptPtrWillBeNoop(agent); 302 return adoptPtrWillBeNoop(agent);
304 } 303 }
305 304
306 WebDevToolsAgentImpl::WebDevToolsAgentImpl( 305 WebDevToolsAgentImpl::WebDevToolsAgentImpl(
307 WebLocalFrameImpl* webLocalFrameImpl, 306 WebLocalFrameImpl* webLocalFrameImpl,
308 WebDevToolsAgentClient* client, 307 WebDevToolsAgentClient* client,
309 PassOwnPtrWillBeRawPtr<InspectorOverlay> overlay) 308 PassOwnPtrWillBeRawPtr<InspectorOverlayImpl> overlay)
310 : m_client(client) 309 : m_client(client)
311 , m_webLocalFrameImpl(webLocalFrameImpl) 310 , m_webLocalFrameImpl(webLocalFrameImpl)
312 , m_attached(false) 311 , m_attached(false)
313 #if ENABLE(ASSERT) 312 #if ENABLE(ASSERT)
314 , m_hasBeenDisposed(false) 313 , m_hasBeenDisposed(false)
315 #endif 314 #endif
316 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents()) 315 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents())
317 , m_injectedScriptManager(InjectedScriptManager::createForPage()) 316 , m_injectedScriptManager(InjectedScriptManager::createForPage())
318 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF rameImpl->frame())) 317 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF rameImpl->frame()))
319 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this))) 318 , m_state(adoptPtrWillBeNoop(new InspectorCompositeState(this)))
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 OwnPtrWillBeRawPtr<InspectorCSSAgent> cssAgentPtr(InspectorCSSAgent::create( m_domAgent, m_pageAgent, m_resourceAgent, m_resourceContentLoader.get())); 452 OwnPtrWillBeRawPtr<InspectorCSSAgent> cssAgentPtr(InspectorCSSAgent::create( m_domAgent, m_pageAgent, m_resourceAgent, m_resourceContentLoader.get()));
454 m_cssAgent = cssAgentPtr.get(); 453 m_cssAgent = cssAgentPtr.get();
455 m_agents.append(cssAgentPtr.release()); 454 m_agents.append(cssAgentPtr.release());
456 455
457 m_agents.append(InspectorAnimationAgent::create(m_pageAgent, m_domAgent)); 456 m_agents.append(InspectorAnimationAgent::create(m_pageAgent, m_domAgent));
458 457
459 m_agents.append(InspectorMemoryAgent::create()); 458 m_agents.append(InspectorMemoryAgent::create());
460 459
461 m_agents.append(InspectorApplicationCacheAgent::create(m_pageAgent)); 460 m_agents.append(InspectorApplicationCacheAgent::create(m_pageAgent));
462 461
463 OwnPtrWillBeRawPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgen t::create(MainThreadDebugger::instance(), m_pageAgent, injectedScriptManager, m_ overlay.get())); 462 OwnPtrWillBeRawPtr<InspectorDebuggerAgent> debuggerAgentPtr(PageDebuggerAgen t::create(MainThreadDebugger::instance(), m_pageAgent, injectedScriptManager));
464 InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get(); 463 InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();
465 m_agents.append(debuggerAgentPtr.release()); 464 m_agents.append(debuggerAgentPtr.release());
466 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent-> v8DebuggerAgent(), m_instrumentingAgents.get())); 465 m_asyncCallTracker = adoptPtrWillBeNoop(new AsyncCallTracker(debuggerAgent-> v8DebuggerAgent(), m_instrumentingAgents.get()));
467 466
468 m_agents.append(InspectorDOMDebuggerAgent::create(injectedScriptManager, m_d omAgent, debuggerAgent->v8DebuggerAgent())); 467 m_agents.append(InspectorDOMDebuggerAgent::create(injectedScriptManager, m_d omAgent, debuggerAgent->v8DebuggerAgent()));
469 468
470 m_agents.append(InspectorInputAgent::create(m_pageAgent)); 469 m_agents.append(InspectorInputAgent::create(m_pageAgent));
471 470
472 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); 471 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate();
473 m_agents.append(InspectorProfilerAgent::create(isolate, injectedScriptManage r, m_overlay.get())); 472 m_agents.append(InspectorProfilerAgent::create(isolate, injectedScriptManage r, m_overlay.get()));
474 473
475 m_agents.append(InspectorHeapProfilerAgent::create(isolate, injectedScriptMa nager)); 474 m_agents.append(InspectorHeapProfilerAgent::create(isolate, injectedScriptMa nager));
476 475
477 m_pageAgent->setDebuggerAgent(debuggerAgent); 476 m_pageAgent->setDebuggerAgent(debuggerAgent);
478 m_pageConsoleAgent->setDebuggerAgent(debuggerAgent->v8DebuggerAgent()); 477 m_pageConsoleAgent->setDebuggerAgent(debuggerAgent->v8DebuggerAgent());
479 478
480 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance(); 479 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance();
481 m_injectedScriptManager->injectedScriptHost()->init( 480 m_injectedScriptManager->injectedScriptHost()->init(
482 m_pageConsoleAgent.get(), 481 m_pageConsoleAgent.get(),
483 debuggerAgent->v8DebuggerAgent(), 482 debuggerAgent->v8DebuggerAgent(),
484 bind<PassRefPtr<TypeBuilder::Runtime::RemoteObject>, PassRefPtr<JSONObje ct>>(&InspectorInspectorAgent::inspect, m_inspectorAgent.get()), 483 bind<PassRefPtr<TypeBuilder::Runtime::RemoteObject>, PassRefPtr<JSONObje ct>>(&InspectorInspectorAgent::inspect, m_inspectorAgent.get()),
485 mainThreadDebugger->debugger(), 484 mainThreadDebugger->debugger(),
486 adoptPtr(new PageInjectedScriptHostClient())); 485 adoptPtr(new PageInjectedScriptHostClient()));
486
487 if (m_overlay)
488 m_overlay->init(m_cssAgent.get(), debuggerAgent);
487 } 489 }
488 490
489 void WebDevToolsAgentImpl::registerAgent(PassOwnPtrWillBeRawPtr<InspectorAgent> agent) 491 void WebDevToolsAgentImpl::registerAgent(PassOwnPtrWillBeRawPtr<InspectorAgent> agent)
490 { 492 {
491 m_agents.append(agent); 493 m_agents.append(agent);
492 } 494 }
493 495
494 void WebDevToolsAgentImpl::attach(const WebString& hostId) 496 void WebDevToolsAgentImpl::attach(const WebString& hostId)
495 { 497 {
496 if (m_attached) 498 if (m_attached)
497 return; 499 return;
498 500
499 // Set the attached bit first so that sync notifications were delivered. 501 // Set the attached bit first so that sync notifications were delivered.
500 m_attached = true; 502 m_attached = true;
501 503
502 initializeDeferredAgents(); 504 initializeDeferredAgents();
503 m_resourceAgent->setHostId(hostId); 505 m_resourceAgent->setHostId(hostId);
504 m_overlay->setLayoutEditor(LayoutEditor::create(m_cssAgent.get()));
505 506
506 m_inspectorFrontend = adoptPtr(new InspectorFrontend(this)); 507 m_inspectorFrontend = adoptPtr(new InspectorFrontend(this));
507 // We can reconnect to existing front-end -> unmute state. 508 // We can reconnect to existing front-end -> unmute state.
508 m_state->unmute(); 509 m_state->unmute();
509 m_agents.setFrontend(m_inspectorFrontend.get()); 510 m_agents.setFrontend(m_inspectorFrontend.get());
510 511
511 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents. get()); 512 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents. get());
512 InspectorInstrumentation::frontendCreated(); 513 InspectorInstrumentation::frontendCreated();
513 514
514 m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(this); 515 m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(this);
(...skipping 22 matching lines...) Expand all
537 m_inspectorBackendDispatcher->clearFrontend(); 538 m_inspectorBackendDispatcher->clearFrontend();
538 m_inspectorBackendDispatcher.clear(); 539 m_inspectorBackendDispatcher.clear();
539 540
540 // Destroying agents would change the state, but we don't want that. 541 // Destroying agents would change the state, but we don't want that.
541 // Pre-disconnect state will be used to restore inspector agents. 542 // Pre-disconnect state will be used to restore inspector agents.
542 m_state->mute(); 543 m_state->mute();
543 m_agents.clearFrontend(); 544 m_agents.clearFrontend();
544 m_inspectorFrontend.clear(); 545 m_inspectorFrontend.clear();
545 546
546 // Release overlay resources. 547 // Release overlay resources.
547 m_overlay->clear(); 548 if (m_overlay)
548 m_overlay->setLayoutEditor(nullptr); 549 m_overlay->clear();
549 InspectorInstrumentation::frontendDeleted(); 550 InspectorInstrumentation::frontendDeleted();
550 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent s.get()); 551 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent s.get());
551 552
552 m_attached = false; 553 m_attached = false;
553 } 554 }
554 555
555 void WebDevToolsAgentImpl::continueProgram() 556 void WebDevToolsAgentImpl::continueProgram()
556 { 557 {
557 ClientMessageLoopAdapter::continueProgram(); 558 ClientMessageLoopAdapter::continueProgram();
558 } 559 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) 756 if (!InspectorBackendDispatcher::getCommandName(message, &commandName))
756 return false; 757 return false;
757 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd) 758 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_pauseCmd)
758 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd) 759 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointCmd)
759 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd) 760 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointByUrlCmd)
760 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 761 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
761 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 762 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
762 } 763 }
763 764
764 } // namespace blink 765 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698