| OLD | NEW |
| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF
rameImpl->frame())) | 308 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF
rameImpl->frame())) |
| 309 , m_overlay(overlay) | 309 , m_overlay(overlay) |
| 310 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())) | 310 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())) |
| 311 , m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames)) | 311 , m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames)) |
| 312 , m_domAgent(nullptr) | 312 , m_domAgent(nullptr) |
| 313 , m_pageAgent(nullptr) | 313 , m_pageAgent(nullptr) |
| 314 , m_resourceAgent(nullptr) | 314 , m_resourceAgent(nullptr) |
| 315 , m_layerTreeAgent(nullptr) | 315 , m_layerTreeAgent(nullptr) |
| 316 , m_tracingAgent(nullptr) | 316 , m_tracingAgent(nullptr) |
| 317 , m_agents(m_instrumentingAgents.get()) | 317 , m_agents(m_instrumentingAgents.get()) |
| 318 , m_deferredAgentsInitialized(false) | |
| 319 , m_includeViewAgents(includeViewAgents) | 318 , m_includeViewAgents(includeViewAgents) |
| 320 , m_sessionId(0) | 319 , m_sessionId(0) |
| 321 , m_stateMuted(false) | 320 , m_stateMuted(false) |
| 322 , m_layerTreeId(0) | 321 , m_layerTreeId(0) |
| 323 { | 322 { |
| 324 DCHECK(isMainThread()); | 323 DCHECK(isMainThread()); |
| 325 DCHECK(m_webLocalFrameImpl->frame()); | 324 DCHECK(m_webLocalFrameImpl->frame()); |
| 326 } | 325 } |
| 327 | 326 |
| 328 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() | 327 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 DCHECK(m_webLocalFrameImpl->frame()); | 376 DCHECK(m_webLocalFrameImpl->frame()); |
| 378 DCHECK(m_inspectedFrames->root()->view()); | 377 DCHECK(m_inspectedFrames->root()->view()); |
| 379 | 378 |
| 380 detach(); | 379 detach(); |
| 381 m_resourceContentLoader->dispose(); | 380 m_resourceContentLoader->dispose(); |
| 382 m_agents.discardAgents(); | 381 m_agents.discardAgents(); |
| 383 m_instrumentingAgents->reset(); | 382 m_instrumentingAgents->reset(); |
| 384 m_v8Session.clear(); | 383 m_v8Session.clear(); |
| 385 } | 384 } |
| 386 | 385 |
| 387 void WebDevToolsAgentImpl::initializeDeferredAgents() | 386 void WebDevToolsAgentImpl::initializeAgents() |
| 388 { | 387 { |
| 389 if (m_deferredAgentsInitialized) | |
| 390 return; | |
| 391 m_deferredAgentsInitialized = true; | |
| 392 | |
| 393 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client); | 388 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client); |
| 394 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance(); | 389 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance(); |
| 395 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); | 390 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); |
| 396 | 391 |
| 397 m_v8Session = mainThreadDebugger->debugger()->connect(mainThreadDebugger->co
ntextGroupId(m_inspectedFrames->root())); | 392 m_v8Session = mainThreadDebugger->debugger()->connect(mainThreadDebugger->co
ntextGroupId(m_inspectedFrames->root())); |
| 398 V8RuntimeAgent* runtimeAgent = m_v8Session->runtimeAgent(); | 393 V8RuntimeAgent* runtimeAgent = m_v8Session->runtimeAgent(); |
| 399 | 394 |
| 400 m_agents.append(PageRuntimeAgent::create(this, runtimeAgent, m_inspectedFram
es.get())); | 395 m_agents.append(PageRuntimeAgent::create(this, runtimeAgent, m_inspectedFram
es.get())); |
| 401 | 396 |
| 402 InspectorDOMAgent* domAgent = InspectorDOMAgent::create(isolate, m_inspected
Frames.get(), runtimeAgent, m_overlay.get()); | 397 InspectorDOMAgent* domAgent = InspectorDOMAgent::create(isolate, m_inspected
Frames.get(), runtimeAgent, m_overlay.get()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 m_agents.append(DeviceOrientationInspectorAgent::create(page)); | 457 m_agents.append(DeviceOrientationInspectorAgent::create(page)); |
| 463 m_agents.append(InspectorAccessibilityAgent::create(page)); | 458 m_agents.append(InspectorAccessibilityAgent::create(page)); |
| 464 m_agents.append(InspectorDOMStorageAgent::create(page)); | 459 m_agents.append(InspectorDOMStorageAgent::create(page)); |
| 465 m_agents.append(InspectorCacheStorageAgent::create()); | 460 m_agents.append(InspectorCacheStorageAgent::create()); |
| 466 } | 461 } |
| 467 | 462 |
| 468 if (m_overlay) | 463 if (m_overlay) |
| 469 m_overlay->init(cssAgent, debuggerAgent, m_domAgent); | 464 m_overlay->init(cssAgent, debuggerAgent, m_domAgent); |
| 470 } | 465 } |
| 471 | 466 |
| 467 void WebDevToolsAgentImpl::destroyAgents() |
| 468 { |
| 469 if (m_overlay) |
| 470 m_overlay->clear(); |
| 471 |
| 472 m_tracingAgent.clear(); |
| 473 m_layerTreeAgent.clear(); |
| 474 m_resourceAgent.clear(); |
| 475 m_pageAgent.clear(); |
| 476 m_domAgent.clear(); |
| 477 |
| 478 m_agents.discardAgents(); |
| 479 m_instrumentingAgents->reset(); |
| 480 m_v8Session.clear(); |
| 481 } |
| 482 |
| 472 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId) | 483 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId) |
| 473 { | 484 { |
| 474 if (m_attached) | 485 if (m_attached) |
| 475 return; | 486 return; |
| 476 | 487 |
| 477 // Set the attached bit first so that sync notifications were delivered. | 488 // Set the attached bit first so that sync notifications were delivered. |
| 478 m_attached = true; | 489 m_attached = true; |
| 479 m_sessionId = sessionId; | 490 m_sessionId = sessionId; |
| 480 | 491 |
| 481 initializeDeferredAgents(); | 492 initializeAgents(); |
| 482 m_resourceAgent->setHostId(hostId); | 493 m_resourceAgent->setHostId(hostId); |
| 483 | 494 |
| 484 m_inspectorFrontend = adoptPtr(new protocol::Frontend(this)); | 495 m_inspectorFrontend = adoptPtr(new protocol::Frontend(this)); |
| 485 // We can reconnect to existing front-end -> unmute state. | 496 // We can reconnect to existing front-end -> unmute state. |
| 486 m_stateMuted = false; | 497 m_stateMuted = false; |
| 487 m_agents.setFrontend(m_inspectorFrontend.get()); | 498 m_agents.setFrontend(m_inspectorFrontend.get()); |
| 488 | 499 |
| 489 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.
get()); | 500 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.
get()); |
| 490 InspectorInstrumentation::frontendCreated(); | 501 InspectorInstrumentation::frontendCreated(); |
| 491 | 502 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 513 | 524 |
| 514 m_inspectorBackendDispatcher->clearFrontend(); | 525 m_inspectorBackendDispatcher->clearFrontend(); |
| 515 m_inspectorBackendDispatcher.clear(); | 526 m_inspectorBackendDispatcher.clear(); |
| 516 | 527 |
| 517 // Destroying agents would change the state, but we don't want that. | 528 // Destroying agents would change the state, but we don't want that. |
| 518 // Pre-disconnect state will be used to restore inspector agents. | 529 // Pre-disconnect state will be used to restore inspector agents. |
| 519 m_stateMuted = true; | 530 m_stateMuted = true; |
| 520 m_agents.clearFrontend(); | 531 m_agents.clearFrontend(); |
| 521 m_inspectorFrontend.clear(); | 532 m_inspectorFrontend.clear(); |
| 522 | 533 |
| 523 // Release overlay resources. | 534 destroyAgents(); |
| 524 if (m_overlay) | |
| 525 m_overlay->clear(); | |
| 526 InspectorInstrumentation::frontendDeleted(); | 535 InspectorInstrumentation::frontendDeleted(); |
| 527 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent
s.get()); | 536 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent
s.get()); |
| 528 | 537 |
| 529 m_sessionId = 0; | 538 m_sessionId = 0; |
| 530 m_attached = false; | 539 m_attached = false; |
| 531 } | 540 } |
| 532 | 541 |
| 533 void WebDevToolsAgentImpl::continueProgram() | 542 void WebDevToolsAgentImpl::continueProgram() |
| 534 { | 543 { |
| 535 ClientMessageLoopAdapter::continueProgram(); | 544 ClientMessageLoopAdapter::continueProgram(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 if (!protocol::Dispatcher::getCommandName(message, &commandName)) | 747 if (!protocol::Dispatcher::getCommandName(message, &commandName)) |
| 739 return false; | 748 return false; |
| 740 return commandName == "Debugger.pause" | 749 return commandName == "Debugger.pause" |
| 741 || commandName == "Debugger.setBreakpoint" | 750 || commandName == "Debugger.setBreakpoint" |
| 742 || commandName == "Debugger.setBreakpointByUrl" | 751 || commandName == "Debugger.setBreakpointByUrl" |
| 743 || commandName == "Debugger.removeBreakpoint" | 752 || commandName == "Debugger.removeBreakpoint" |
| 744 || commandName == "Debugger.setBreakpointsActive"; | 753 || commandName == "Debugger.setBreakpointsActive"; |
| 745 } | 754 } |
| 746 | 755 |
| 747 } // namespace blink | 756 } // namespace blink |
| OLD | NEW |