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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/InspectorPageAgent.h" | 57 #include "core/inspector/InspectorPageAgent.h" |
58 #include "core/inspector/InspectorProfilerAgent.h" | 58 #include "core/inspector/InspectorProfilerAgent.h" |
59 #include "core/inspector/InspectorResourceAgent.h" | 59 #include "core/inspector/InspectorResourceAgent.h" |
60 #include "core/inspector/InspectorResourceContentLoader.h" | 60 #include "core/inspector/InspectorResourceContentLoader.h" |
61 #include "core/inspector/InspectorState.h" | |
62 #include "core/inspector/InspectorTaskRunner.h" | 61 #include "core/inspector/InspectorTaskRunner.h" |
63 #include "core/inspector/InspectorTimelineAgent.h" | 62 #include "core/inspector/InspectorTimelineAgent.h" |
64 #include "core/inspector/InspectorTracingAgent.h" | 63 #include "core/inspector/InspectorTracingAgent.h" |
65 #include "core/inspector/InspectorWorkerAgent.h" | 64 #include "core/inspector/InspectorWorkerAgent.h" |
66 #include "core/inspector/InstrumentingAgents.h" | 65 #include "core/inspector/InstrumentingAgents.h" |
67 #include "core/inspector/LayoutEditor.h" | 66 #include "core/inspector/LayoutEditor.h" |
68 #include "core/inspector/MainThreadDebugger.h" | 67 #include "core/inspector/MainThreadDebugger.h" |
69 #include "core/inspector/PageConsoleAgent.h" | 68 #include "core/inspector/PageConsoleAgent.h" |
70 #include "core/inspector/PageDebuggerAgent.h" | 69 #include "core/inspector/PageDebuggerAgent.h" |
71 #include "core/inspector/PageRuntimeAgent.h" | 70 #include "core/inspector/PageRuntimeAgent.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 PassOwnPtrWillBeRawPtr<InspectorOverlay> overlay) | 311 PassOwnPtrWillBeRawPtr<InspectorOverlay> overlay) |
313 : m_client(client) | 312 : m_client(client) |
314 , m_webLocalFrameImpl(webLocalFrameImpl) | 313 , m_webLocalFrameImpl(webLocalFrameImpl) |
315 , m_attached(false) | 314 , m_attached(false) |
316 #if ENABLE(ASSERT) | 315 #if ENABLE(ASSERT) |
317 , m_hasBeenDisposed(false) | 316 , m_hasBeenDisposed(false) |
318 #endif | 317 #endif |
319 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents()) | 318 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents()) |
320 , m_injectedScriptManager(InjectedScriptManager::createForPage()) | 319 , m_injectedScriptManager(InjectedScriptManager::createForPage()) |
321 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF
rameImpl->frame())) | 320 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF
rameImpl->frame())) |
322 , m_state(adoptPtr(new InspectorCompositeState(this))) | |
323 , m_overlay(overlay) | 321 , m_overlay(overlay) |
324 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())) | 322 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())) |
325 , m_inspectorAgent(nullptr) | 323 , m_inspectorAgent(nullptr) |
326 , m_domAgent(nullptr) | 324 , m_domAgent(nullptr) |
327 , m_pageAgent(nullptr) | 325 , m_pageAgent(nullptr) |
328 , m_resourceAgent(nullptr) | 326 , m_resourceAgent(nullptr) |
329 , m_layerTreeAgent(nullptr) | 327 , m_layerTreeAgent(nullptr) |
330 , m_tracingAgent(nullptr) | 328 , m_tracingAgent(nullptr) |
331 , m_pageRuntimeAgent(nullptr) | 329 , m_pageRuntimeAgent(nullptr) |
332 , m_pageConsoleAgent(nullptr) | 330 , m_pageConsoleAgent(nullptr) |
333 , m_agents(m_instrumentingAgents.get(), m_state.get()) | 331 , m_agents(m_instrumentingAgents.get()) |
334 , m_deferredAgentsInitialized(false) | 332 , m_deferredAgentsInitialized(false) |
335 , m_sessionId(0) | 333 , m_sessionId(0) |
| 334 , m_stateMuted(false) |
336 { | 335 { |
337 ASSERT(isMainThread()); | 336 ASSERT(isMainThread()); |
338 ASSERT(m_webLocalFrameImpl->frame()); | 337 ASSERT(m_webLocalFrameImpl->frame()); |
339 | 338 |
340 long processId = Platform::current()->getUniqueIdForProcess(); | 339 long processId = Platform::current()->getUniqueIdForProcess(); |
341 ASSERT(processId > 0); | 340 ASSERT(processId > 0); |
342 IdentifiersFactory::setProcessId(processId); | 341 IdentifiersFactory::setProcessId(processId); |
343 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get()
; | 342 InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get()
; |
344 | 343 |
345 OwnPtrWillBeRawPtr<InspectorInspectorAgent> inspectorAgentPtr(InspectorInspe
ctorAgent::create(injectedScriptManager)); | 344 OwnPtrWillBeRawPtr<InspectorInspectorAgent> inspectorAgentPtr(InspectorInspe
ctorAgent::create(injectedScriptManager)); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 504 |
506 // Set the attached bit first so that sync notifications were delivered. | 505 // Set the attached bit first so that sync notifications were delivered. |
507 m_attached = true; | 506 m_attached = true; |
508 m_sessionId = sessionId; | 507 m_sessionId = sessionId; |
509 | 508 |
510 initializeDeferredAgents(); | 509 initializeDeferredAgents(); |
511 m_resourceAgent->setHostId(hostId); | 510 m_resourceAgent->setHostId(hostId); |
512 | 511 |
513 m_inspectorFrontend = adoptPtr(new InspectorFrontend(this)); | 512 m_inspectorFrontend = adoptPtr(new InspectorFrontend(this)); |
514 // We can reconnect to existing front-end -> unmute state. | 513 // We can reconnect to existing front-end -> unmute state. |
515 m_state->unmute(); | 514 m_stateMuted = false; |
516 m_agents.setFrontend(m_inspectorFrontend.get()); | 515 m_agents.setFrontend(m_inspectorFrontend.get()); |
517 | 516 |
518 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.
get()); | 517 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.
get()); |
519 InspectorInstrumentation::frontendCreated(); | 518 InspectorInstrumentation::frontendCreated(); |
520 | 519 |
521 m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(this); | 520 m_inspectorBackendDispatcher = InspectorBackendDispatcher::create(this); |
522 m_agents.registerInDispatcher(m_inspectorBackendDispatcher.get()); | 521 m_agents.registerInDispatcher(m_inspectorBackendDispatcher.get()); |
523 | 522 |
524 Platform::current()->currentThread()->addTaskObserver(this); | 523 Platform::current()->currentThread()->addTaskObserver(this); |
525 } | 524 } |
526 | 525 |
527 void WebDevToolsAgentImpl::reattach(const WebString& hostId, int sessionId, cons
t WebString& savedState) | 526 void WebDevToolsAgentImpl::reattach(const WebString& hostId, int sessionId, cons
t WebString& savedState) |
528 { | 527 { |
529 if (m_attached) | 528 if (m_attached) |
530 return; | 529 return; |
531 | 530 |
532 attach(hostId, sessionId); | 531 attach(hostId, sessionId); |
533 m_state->loadFromCookie(savedState); | 532 m_agents.restore(savedState); |
534 m_agents.restore(); | |
535 } | 533 } |
536 | 534 |
537 void WebDevToolsAgentImpl::detach() | 535 void WebDevToolsAgentImpl::detach() |
538 { | 536 { |
539 if (!m_attached) | 537 if (!m_attached) |
540 return; | 538 return; |
541 | 539 |
542 Platform::current()->currentThread()->removeTaskObserver(this); | 540 Platform::current()->currentThread()->removeTaskObserver(this); |
543 | 541 |
544 m_inspectorBackendDispatcher->clearFrontend(); | 542 m_inspectorBackendDispatcher->clearFrontend(); |
545 m_inspectorBackendDispatcher.clear(); | 543 m_inspectorBackendDispatcher.clear(); |
546 | 544 |
547 // Destroying agents would change the state, but we don't want that. | 545 // Destroying agents would change the state, but we don't want that. |
548 // Pre-disconnect state will be used to restore inspector agents. | 546 // Pre-disconnect state will be used to restore inspector agents. |
549 m_state->mute(); | 547 m_stateMuted = true; |
550 m_agents.clearFrontend(); | 548 m_agents.clearFrontend(); |
551 m_inspectorFrontend.clear(); | 549 m_inspectorFrontend.clear(); |
552 | 550 |
553 // Release overlay resources. | 551 // Release overlay resources. |
554 if (m_overlay) | 552 if (m_overlay) |
555 m_overlay->clear(); | 553 m_overlay->clear(); |
556 InspectorInstrumentation::frontendDeleted(); | 554 InspectorInstrumentation::frontendDeleted(); |
557 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent
s.get()); | 555 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent
s.get()); |
558 | 556 |
559 m_sessionId = 0; | 557 m_sessionId = 0; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 if (!node && m_webLocalFrameImpl->frame()->document()) | 636 if (!node && m_webLocalFrameImpl->frame()->document()) |
639 node = m_webLocalFrameImpl->frame()->document()->documentElement(); | 637 node = m_webLocalFrameImpl->frame()->document()->documentElement(); |
640 m_domAgent->inspect(node); | 638 m_domAgent->inspect(node); |
641 } | 639 } |
642 | 640 |
643 void WebDevToolsAgentImpl::sendProtocolResponse(int sessionId, int callId, PassR
efPtr<JSONObject> message) | 641 void WebDevToolsAgentImpl::sendProtocolResponse(int sessionId, int callId, PassR
efPtr<JSONObject> message) |
644 { | 642 { |
645 if (!m_attached) | 643 if (!m_attached) |
646 return; | 644 return; |
647 flushPendingProtocolNotifications(); | 645 flushPendingProtocolNotifications(); |
648 m_client->sendProtocolMessage(sessionId, callId, message->toJSONString(), m_
stateCookie); | 646 String stateToSend; |
649 m_stateCookie = String(); | 647 if (!m_stateMuted) { |
| 648 stateToSend = m_agents.state(); |
| 649 if (stateToSend == m_stateCookie) |
| 650 stateToSend = String(); |
| 651 else |
| 652 m_stateCookie = stateToSend; |
| 653 } |
| 654 m_client->sendProtocolMessage(sessionId, callId, message->toJSONString(), st
ateToSend); |
650 } | 655 } |
651 | 656 |
652 void WebDevToolsAgentImpl::sendProtocolNotification(PassRefPtr<JSONObject> messa
ge) | 657 void WebDevToolsAgentImpl::sendProtocolNotification(PassRefPtr<JSONObject> messa
ge) |
653 { | 658 { |
654 if (!m_attached) | 659 if (!m_attached) |
655 return; | 660 return; |
656 m_notificationQueue.append(std::make_pair(m_sessionId, message)); | 661 m_notificationQueue.append(std::make_pair(m_sessionId, message)); |
657 } | 662 } |
658 | 663 |
659 void WebDevToolsAgentImpl::flush() | 664 void WebDevToolsAgentImpl::flush() |
660 { | 665 { |
661 flushPendingProtocolNotifications(); | 666 flushPendingProtocolNotifications(); |
662 } | 667 } |
663 | 668 |
664 void WebDevToolsAgentImpl::updateInspectorStateCookie(const String& state) | |
665 { | |
666 m_stateCookie = state; | |
667 } | |
668 | |
669 void WebDevToolsAgentImpl::resumeStartup() | 669 void WebDevToolsAgentImpl::resumeStartup() |
670 { | 670 { |
671 m_client->resumeStartup(); | 671 m_client->resumeStartup(); |
672 } | 672 } |
673 | 673 |
674 void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString&
script) | 674 void WebDevToolsAgentImpl::evaluateInWebInspector(long callId, const WebString&
script) |
675 { | 675 { |
676 m_inspectorAgent->evaluateForTestInFrontend(callId, script); | 676 m_inspectorAgent->evaluateForTestInFrontend(callId, script); |
677 } | 677 } |
678 | 678 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) | 725 if (!InspectorBackendDispatcher::getCommandName(message, &commandName)) |
726 return false; | 726 return false; |
727 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_pauseCmd) | 727 return commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_pauseCmd) |
728 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointCmd) | 728 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointCmd) |
729 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointByUrlCmd) | 729 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointByUrlCmd) |
730 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) | 730 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) |
731 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); | 731 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); |
732 } | 732 } |
733 | 733 |
734 } // namespace blink | 734 } // namespace blink |
OLD | NEW |