| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/WebDevToolsAgentImpl.h" | 31 #include "web/WebDevToolsAgentImpl.h" |
| 32 | 32 |
| 33 #include <v8-inspector.h> |
| 34 #include <memory> |
| 35 |
| 33 #include "bindings/core/v8/ScriptController.h" | 36 #include "bindings/core/v8/ScriptController.h" |
| 34 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
| 35 #include "core/InstrumentingAgents.h" | 38 #include "core/InstrumentingAgents.h" |
| 36 #include "core/frame/FrameHost.h" | 39 #include "core/frame/FrameHost.h" |
| 37 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 38 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 40 #include "core/inspector/InspectedFrames.h" | 43 #include "core/inspector/InspectedFrames.h" |
| 41 #include "core/inspector/InspectorAnimationAgent.h" | 44 #include "core/inspector/InspectorAnimationAgent.h" |
| 42 #include "core/inspector/InspectorApplicationCacheAgent.h" | 45 #include "core/inspector/InspectorApplicationCacheAgent.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "web/InspectorRenderingAgent.h" | 85 #include "web/InspectorRenderingAgent.h" |
| 83 #include "web/WebFrameWidgetImpl.h" | 86 #include "web/WebFrameWidgetImpl.h" |
| 84 #include "web/WebInputEventConversion.h" | 87 #include "web/WebInputEventConversion.h" |
| 85 #include "web/WebLocalFrameImpl.h" | 88 #include "web/WebLocalFrameImpl.h" |
| 86 #include "web/WebSettingsImpl.h" | 89 #include "web/WebSettingsImpl.h" |
| 87 #include "web/WebViewImpl.h" | 90 #include "web/WebViewImpl.h" |
| 88 #include "wtf/MathExtras.h" | 91 #include "wtf/MathExtras.h" |
| 89 #include "wtf/Noncopyable.h" | 92 #include "wtf/Noncopyable.h" |
| 90 #include "wtf/PtrUtil.h" | 93 #include "wtf/PtrUtil.h" |
| 91 #include "wtf/text/WTFString.h" | 94 #include "wtf/text/WTFString.h" |
| 92 #include <memory> | |
| 93 #include <v8-inspector.h> | |
| 94 | 95 |
| 95 namespace blink { | 96 namespace blink { |
| 96 | 97 |
| 97 namespace { | 98 namespace { |
| 98 | 99 |
| 99 bool isMainFrame(WebLocalFrameImpl* frame) { | 100 bool isMainFrame(WebLocalFrameImpl* frame) { |
| 100 // TODO(dgozman): sometimes view->mainFrameImpl() does return null, even | 101 // TODO(dgozman): sometimes view->mainFrameImpl() does return null, even |
| 101 // though |frame| is meant to be main frame. See http://crbug.com/526162. | 102 // though |frame| is meant to be main frame. See http://crbug.com/526162. |
| 102 return frame->viewImpl() && !frame->parent(); | 103 return frame->viewImpl() && !frame->parent(); |
| 103 } | 104 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 m_resourceContentLoader( | 263 m_resourceContentLoader( |
| 263 InspectorResourceContentLoader::create(m_webLocalFrameImpl->frame())), | 264 InspectorResourceContentLoader::create(m_webLocalFrameImpl->frame())), |
| 264 m_overlay(overlay), | 265 m_overlay(overlay), |
| 265 m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())), | 266 m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())), |
| 266 m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames)), | 267 m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames)), |
| 267 m_domAgent(nullptr), | 268 m_domAgent(nullptr), |
| 268 m_pageAgent(nullptr), | 269 m_pageAgent(nullptr), |
| 269 m_networkAgent(nullptr), | 270 m_networkAgent(nullptr), |
| 270 m_layerTreeAgent(nullptr), | 271 m_layerTreeAgent(nullptr), |
| 271 m_tracingAgent(nullptr), | 272 m_tracingAgent(nullptr), |
| 273 m_traceEventsAgent(new InspectorTraceEvents()), |
| 272 m_includeViewAgents(includeViewAgents), | 274 m_includeViewAgents(includeViewAgents), |
| 273 m_layerTreeId(0) { | 275 m_layerTreeId(0) { |
| 274 DCHECK(isMainThread()); | 276 DCHECK(isMainThread()); |
| 275 DCHECK(m_webLocalFrameImpl->frame()); | 277 DCHECK(m_webLocalFrameImpl->frame()); |
| 278 m_instrumentingAgents->addInspectorTraceEvents(m_traceEventsAgent); |
| 276 } | 279 } |
| 277 | 280 |
| 278 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { | 281 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() { |
| 279 DCHECK(!m_client); | 282 DCHECK(!m_client); |
| 280 } | 283 } |
| 281 | 284 |
| 282 DEFINE_TRACE(WebDevToolsAgentImpl) { | 285 DEFINE_TRACE(WebDevToolsAgentImpl) { |
| 283 visitor->trace(m_webLocalFrameImpl); | 286 visitor->trace(m_webLocalFrameImpl); |
| 284 visitor->trace(m_instrumentingAgents); | 287 visitor->trace(m_instrumentingAgents); |
| 285 visitor->trace(m_resourceContentLoader); | 288 visitor->trace(m_resourceContentLoader); |
| 286 visitor->trace(m_overlay); | 289 visitor->trace(m_overlay); |
| 287 visitor->trace(m_inspectedFrames); | 290 visitor->trace(m_inspectedFrames); |
| 288 visitor->trace(m_resourceContainer); | 291 visitor->trace(m_resourceContainer); |
| 289 visitor->trace(m_domAgent); | 292 visitor->trace(m_domAgent); |
| 290 visitor->trace(m_pageAgent); | 293 visitor->trace(m_pageAgent); |
| 291 visitor->trace(m_networkAgent); | 294 visitor->trace(m_networkAgent); |
| 292 visitor->trace(m_layerTreeAgent); | 295 visitor->trace(m_layerTreeAgent); |
| 293 visitor->trace(m_tracingAgent); | 296 visitor->trace(m_tracingAgent); |
| 297 visitor->trace(m_traceEventsAgent); |
| 294 visitor->trace(m_session); | 298 visitor->trace(m_session); |
| 295 } | 299 } |
| 296 | 300 |
| 297 void WebDevToolsAgentImpl::willBeDestroyed() { | 301 void WebDevToolsAgentImpl::willBeDestroyed() { |
| 298 DCHECK(m_webLocalFrameImpl->frame()); | 302 DCHECK(m_webLocalFrameImpl->frame()); |
| 299 DCHECK(m_inspectedFrames->root()->view()); | 303 DCHECK(m_inspectedFrames->root()->view()); |
| 304 m_instrumentingAgents->removeInspectorTraceEvents(m_traceEventsAgent); |
| 305 m_traceEventsAgent = nullptr; |
| 300 detach(); | 306 detach(); |
| 301 m_resourceContentLoader->dispose(); | 307 m_resourceContentLoader->dispose(); |
| 302 m_client = nullptr; | 308 m_client = nullptr; |
| 303 } | 309 } |
| 304 | 310 |
| 305 void WebDevToolsAgentImpl::initializeSession(int sessionId, | 311 void WebDevToolsAgentImpl::initializeSession(int sessionId, |
| 306 const String& hostId, | 312 const String& hostId, |
| 307 String* state) { | 313 String* state) { |
| 308 DCHECK(m_client); | 314 DCHECK(m_client); |
| 309 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client); | 315 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 } | 652 } |
| 647 | 653 |
| 648 bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method) { | 654 bool WebDevToolsAgent::shouldInterruptForMethod(const WebString& method) { |
| 649 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || | 655 return method == "Debugger.pause" || method == "Debugger.setBreakpoint" || |
| 650 method == "Debugger.setBreakpointByUrl" || | 656 method == "Debugger.setBreakpointByUrl" || |
| 651 method == "Debugger.removeBreakpoint" || | 657 method == "Debugger.removeBreakpoint" || |
| 652 method == "Debugger.setBreakpointsActive"; | 658 method == "Debugger.setBreakpointsActive"; |
| 653 } | 659 } |
| 654 | 660 |
| 655 } // namespace blink | 661 } // namespace blink |
| OLD | NEW |