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