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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 #include "wtf/PtrUtil.h" | 91 #include "wtf/PtrUtil.h" |
92 #include "wtf/text/WTFString.h" | 92 #include "wtf/text/WTFString.h" |
93 #include <memory> | 93 #include <memory> |
94 #include <v8-inspector.h> | 94 #include <v8-inspector.h> |
95 | 95 |
96 namespace blink { | 96 namespace blink { |
97 | 97 |
98 namespace { | 98 namespace { |
99 | 99 |
100 bool isMainFrame(WebLocalFrameImpl* frame) { | 100 bool isMainFrame(WebLocalFrameImpl* frame) { |
101 // TODO(dgozman): sometimes view->mainFrameImpl() does return null, even thoug
h |frame| is meant to be main frame. | 101 // TODO(dgozman): sometimes view->mainFrameImpl() does return null, even |
102 // See http://crbug.com/526162. | 102 // though |frame| is meant to be main frame. See http://crbug.com/526162. |
103 return frame->viewImpl() && !frame->parent(); | 103 return frame->viewImpl() && !frame->parent(); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 class ClientMessageLoopAdapter : public MainThreadDebugger::ClientMessageLoop { | 107 class ClientMessageLoopAdapter : public MainThreadDebugger::ClientMessageLoop { |
108 public: | 108 public: |
109 ~ClientMessageLoopAdapter() override { s_instance = nullptr; } | 109 ~ClientMessageLoopAdapter() override { s_instance = nullptr; } |
110 | 110 |
111 static void ensureMainThreadDebuggerCreated(WebDevToolsAgentClient* client) { | 111 static void ensureMainThreadDebuggerCreated(WebDevToolsAgentClient* client) { |
112 if (s_instance) | 112 if (s_instance) |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 m_pageAgent = pageAgent; | 427 m_pageAgent = pageAgent; |
428 m_session->append(pageAgent); | 428 m_session->append(pageAgent); |
429 | 429 |
430 m_session->append(new InspectorLogAgent( | 430 m_session->append(new InspectorLogAgent( |
431 &m_inspectedFrames->root()->host()->consoleMessageStorage())); | 431 &m_inspectedFrames->root()->host()->consoleMessageStorage())); |
432 | 432 |
433 m_tracingAgent->setLayerTreeId(m_layerTreeId); | 433 m_tracingAgent->setLayerTreeId(m_layerTreeId); |
434 m_networkAgent->setHostId(hostId); | 434 m_networkAgent->setHostId(hostId); |
435 | 435 |
436 if (m_includeViewAgents) { | 436 if (m_includeViewAgents) { |
437 // TODO(dgozman): we should actually pass the view instead of frame, but dur
ing | 437 // TODO(dgozman): we should actually pass the view instead of frame, but |
438 // remote->local transition we cannot access mainFrameImpl() yet, so we have
to store the | 438 // during remote->local transition we cannot access mainFrameImpl() yet, so |
439 // frame which will become the main frame later. | 439 // we have to store the frame which will become the main frame later. |
440 m_session->append( | 440 m_session->append( |
441 InspectorRenderingAgent::create(m_webLocalFrameImpl, m_overlay.get())); | 441 InspectorRenderingAgent::create(m_webLocalFrameImpl, m_overlay.get())); |
442 m_session->append( | 442 m_session->append( |
443 InspectorEmulationAgent::create(m_webLocalFrameImpl, this)); | 443 InspectorEmulationAgent::create(m_webLocalFrameImpl, this)); |
444 // TODO(dgozman): migrate each of the following agents to frame once module
is ready. | 444 // TODO(dgozman): migrate each of the following agents to frame once module |
| 445 // is ready. |
445 Page* page = m_webLocalFrameImpl->viewImpl()->page(); | 446 Page* page = m_webLocalFrameImpl->viewImpl()->page(); |
446 m_session->append(InspectorDatabaseAgent::create(page)); | 447 m_session->append(InspectorDatabaseAgent::create(page)); |
447 m_session->append(DeviceOrientationInspectorAgent::create(page)); | 448 m_session->append(DeviceOrientationInspectorAgent::create(page)); |
448 m_session->append(new InspectorAccessibilityAgent(page, m_domAgent)); | 449 m_session->append(new InspectorAccessibilityAgent(page, m_domAgent)); |
449 m_session->append(InspectorDOMStorageAgent::create(page)); | 450 m_session->append(InspectorDOMStorageAgent::create(page)); |
450 m_session->append(InspectorCacheStorageAgent::create()); | 451 m_session->append(InspectorCacheStorageAgent::create()); |
451 } | 452 } |
452 | 453 |
453 if (m_overlay) | 454 if (m_overlay) |
454 m_overlay->init(cssAgent, m_session->v8Session(), m_domAgent); | 455 m_overlay->init(cssAgent, m_session->v8Session(), m_domAgent); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 682 |
682 WebDevToolsAgentImpl* agentImpl = | 683 WebDevToolsAgentImpl* agentImpl = |
683 static_cast<WebDevToolsAgentImpl*>(webagent); | 684 static_cast<WebDevToolsAgentImpl*>(webagent); |
684 if (agentImpl->attached()) | 685 if (agentImpl->attached()) |
685 agentImpl->dispatchMessageFromFrontend(sessionId, descriptor->method(), | 686 agentImpl->dispatchMessageFromFrontend(sessionId, descriptor->method(), |
686 descriptor->message()); | 687 descriptor->message()); |
687 } | 688 } |
688 | 689 |
689 void WebDevToolsAgent::interruptAndDispatch(int sessionId, | 690 void WebDevToolsAgent::interruptAndDispatch(int sessionId, |
690 MessageDescriptor* rawDescriptor) { | 691 MessageDescriptor* rawDescriptor) { |
691 // rawDescriptor can't be a std::unique_ptr because interruptAndDispatch is a
WebKit API function. | 692 // rawDescriptor can't be a std::unique_ptr because interruptAndDispatch is a |
| 693 // WebKit API function. |
692 MainThreadDebugger::interruptMainThreadAndRun( | 694 MainThreadDebugger::interruptMainThreadAndRun( |
693 crossThreadBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, | 695 crossThreadBind(WebDevToolsAgentImpl::runDebuggerTask, sessionId, |
694 passed(wrapUnique(rawDescriptor)))); | 696 passed(wrapUnique(rawDescriptor)))); |
695 } | 697 } |
696 | 698 |
697 bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method) { | 699 bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method) { |
698 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || | 700 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || |
699 method == "Debugger.setBreakpointByUrl" || | 701 method == "Debugger.setBreakpointByUrl" || |
700 method == "Debugger.removeBreakpoint" || | 702 method == "Debugger.removeBreakpoint" || |
701 method == "Debugger.setBreakpointsActive"; | 703 method == "Debugger.setBreakpointsActive"; |
702 } | 704 } |
703 | 705 |
704 } // namespace blink | 706 } // namespace blink |
OLD | NEW |