Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: Source/core/inspector/InspectorDOMDebuggerAgent.cpp

Issue 1286343003: DevTools: make InspectorDebuggerAgent aggregate V8DebuggerAgent instead of inheriting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed presubmit errors Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 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 28 matching lines...) Expand all
39 #include "core/events/EventTarget.h" 39 #include "core/events/EventTarget.h"
40 #include "core/frame/LocalDOMWindow.h" 40 #include "core/frame/LocalDOMWindow.h"
41 #include "core/inspector/EventListenerInfo.h" 41 #include "core/inspector/EventListenerInfo.h"
42 #include "core/inspector/InjectedScript.h" 42 #include "core/inspector/InjectedScript.h"
43 #include "core/inspector/InjectedScriptHost.h" 43 #include "core/inspector/InjectedScriptHost.h"
44 #include "core/inspector/InjectedScriptManager.h" 44 #include "core/inspector/InjectedScriptManager.h"
45 #include "core/inspector/InspectorDOMAgent.h" 45 #include "core/inspector/InspectorDOMAgent.h"
46 #include "core/inspector/InspectorState.h" 46 #include "core/inspector/InspectorState.h"
47 #include "core/inspector/InstrumentingAgents.h" 47 #include "core/inspector/InstrumentingAgents.h"
48 #include "core/inspector/RemoteObjectId.h" 48 #include "core/inspector/RemoteObjectId.h"
49 #include "core/inspector/V8DebuggerAgent.h"
49 #include "platform/JSONValues.h" 50 #include "platform/JSONValues.h"
50 51
51 namespace { 52 namespace {
52 53
53 enum DOMBreakpointType { 54 enum DOMBreakpointType {
54 SubtreeModified = 0, 55 SubtreeModified = 0,
55 AttributeModified, 56 AttributeModified,
56 NodeRemoved, 57 NodeRemoved,
57 DOMBreakpointTypesCount 58 DOMBreakpointTypesCount
58 }; 59 };
(...skipping 22 matching lines...) Expand all
81 static const char webglErrorNameProperty[] = "webglErrorName"; 82 static const char webglErrorNameProperty[] = "webglErrorName";
82 83
83 namespace DOMDebuggerAgentState { 84 namespace DOMDebuggerAgentState {
84 static const char eventListenerBreakpoints[] = "eventListenerBreakpoints"; 85 static const char eventListenerBreakpoints[] = "eventListenerBreakpoints";
85 static const char eventTargetAny[] = "*"; 86 static const char eventTargetAny[] = "*";
86 static const char pauseOnAllXHRs[] = "pauseOnAllXHRs"; 87 static const char pauseOnAllXHRs[] = "pauseOnAllXHRs";
87 static const char xhrBreakpoints[] = "xhrBreakpoints"; 88 static const char xhrBreakpoints[] = "xhrBreakpoints";
88 static const char enabled[] = "enabled"; 89 static const char enabled[] = "enabled";
89 } 90 }
90 91
91 PassOwnPtrWillBeRawPtr<InspectorDOMDebuggerAgent> InspectorDOMDebuggerAgent::cre ate(InjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent, I nspectorDebuggerAgent* debuggerAgent) 92 PassOwnPtrWillBeRawPtr<InspectorDOMDebuggerAgent> InspectorDOMDebuggerAgent::cre ate(InjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent, V 8DebuggerAgent* debuggerAgent)
92 { 93 {
93 return adoptPtrWillBeNoop(new InspectorDOMDebuggerAgent(injectedScriptManage r, domAgent, debuggerAgent)); 94 return adoptPtrWillBeNoop(new InspectorDOMDebuggerAgent(injectedScriptManage r, domAgent, debuggerAgent));
94 } 95 }
95 96
96 InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(InjectedScriptManager* inje ctedScriptManager, InspectorDOMAgent* domAgent, InspectorDebuggerAgent* debugger Agent) 97 InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(InjectedScriptManager* inje ctedScriptManager, InspectorDOMAgent* domAgent, V8DebuggerAgent* debuggerAgent)
97 : InspectorBaseAgent<InspectorDOMDebuggerAgent, InspectorFrontend::DOMDebugg er>("DOMDebugger") 98 : InspectorBaseAgent<InspectorDOMDebuggerAgent, InspectorFrontend::DOMDebugg er>("DOMDebugger")
98 , m_injectedScriptManager(injectedScriptManager) 99 , m_injectedScriptManager(injectedScriptManager)
99 , m_domAgent(domAgent) 100 , m_domAgent(domAgent)
100 , m_debuggerAgent(debuggerAgent) 101 , m_debuggerAgent(debuggerAgent)
101 { 102 {
102 } 103 }
103 104
104 InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent() 105 InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent()
105 { 106 {
106 #if !ENABLE(OILPAN) 107 #if !ENABLE(OILPAN)
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 419 }
419 420
420 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo intType, bool insertion, JSONObject* description) 421 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo intType, bool insertion, JSONObject* description)
421 { 422 {
422 ASSERT(hasBreakpoint(target, breakpointType)); 423 ASSERT(hasBreakpoint(target, breakpointType));
423 424
424 Node* breakpointOwner = target; 425 Node* breakpointOwner = target;
425 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { 426 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
426 // For inheritable breakpoint types, target node isn't always the same a s the node that owns a breakpoint. 427 // For inheritable breakpoint types, target node isn't always the same a s the node that owns a breakpoint.
427 // Target node may be unknown to frontend, so we need to push it first. 428 // Target node may be unknown to frontend, so we need to push it first.
428 RefPtr<TypeBuilder::Runtime::RemoteObject> targetNodeObject = m_domAgent ->resolveNode(target, InspectorDebuggerAgent::backtraceObjectGroup); 429 RefPtr<TypeBuilder::Runtime::RemoteObject> targetNodeObject = m_domAgent ->resolveNode(target, V8DebuggerAgent::backtraceObjectGroup);
429 description->setValue("targetNode", targetNodeObject); 430 description->setValue("targetNode", targetNodeObject);
430 431
431 // Find breakpoint owner node. 432 // Find breakpoint owner node.
432 if (!insertion) 433 if (!insertion)
433 breakpointOwner = InspectorDOMAgent::innerParentNode(target); 434 breakpointOwner = InspectorDOMAgent::innerParentNode(target);
434 ASSERT(breakpointOwner); 435 ASSERT(breakpointOwner);
435 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType))) { 436 while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType))) {
436 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne r); 437 Node* parentNode = InspectorDOMAgent::innerParentNode(breakpointOwne r);
437 if (!parentNode) 438 if (!parentNode)
438 break; 439 break;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(animationFrameFired EventName, 0), false); 541 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(animationFrameFired EventName, 0), false);
541 } 542 }
542 543
543 void InspectorDOMDebuggerAgent::willHandleEvent(EventTarget* target, Event* even t, EventListener*, bool) 544 void InspectorDOMDebuggerAgent::willHandleEvent(EventTarget* target, Event* even t, EventListener*, bool)
544 { 545 {
545 Node* node = target->toNode(); 546 Node* node = target->toNode();
546 String targetName = node ? node->nodeName() : target->interfaceName(); 547 String targetName = node ? node->nodeName() : target->interfaceName();
547 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(event->type(), &tar getName), false); 548 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(event->type(), &tar getName), false);
548 } 549 }
549 550
550 void InspectorDOMDebuggerAgent::willEvaluateScript(const String& url, int) 551 void InspectorDOMDebuggerAgent::willEvaluateScript()
551 { 552 {
552 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(scriptFirstStatemen tEventName, 0), false); 553 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(scriptFirstStatemen tEventName, 0), false);
553 } 554 }
554 555
555 void InspectorDOMDebuggerAgent::willCloseWindow() 556 void InspectorDOMDebuggerAgent::willCloseWindow()
556 { 557 {
557 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(windowCloseEventNam e, 0), true); 558 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(windowCloseEventNam e, 0), true);
558 } 559 }
559 560
560 void InspectorDOMDebuggerAgent::didFireWebGLError(const String& errorName) 561 void InspectorDOMDebuggerAgent::didFireWebGLError(const String& errorName)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 if (enabled) { 661 if (enabled) {
661 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this); 662 m_instrumentingAgents->setInspectorDOMDebuggerAgent(this);
662 m_state->setBoolean(DOMDebuggerAgentState::enabled, true); 663 m_state->setBoolean(DOMDebuggerAgentState::enabled, true);
663 } else { 664 } else {
664 m_state->remove(DOMDebuggerAgentState::enabled); 665 m_state->remove(DOMDebuggerAgentState::enabled);
665 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); 666 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr);
666 } 667 }
667 } 668 }
668 669
669 } // namespace blink 670 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698