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

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

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 21 matching lines...) Expand all
32 32
33 #include "bindings/core/v8/ScriptEventListener.h" 33 #include "bindings/core/v8/ScriptEventListener.h"
34 #include "bindings/core/v8/V8EventTarget.h" 34 #include "bindings/core/v8/V8EventTarget.h"
35 #include "core/dom/Element.h" 35 #include "core/dom/Element.h"
36 #include "core/dom/Node.h" 36 #include "core/dom/Node.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/events/EventTarget.h" 38 #include "core/events/EventTarget.h"
39 #include "core/frame/LocalDOMWindow.h" 39 #include "core/frame/LocalDOMWindow.h"
40 #include "core/inspector/InspectorDOMAgent.h" 40 #include "core/inspector/InspectorDOMAgent.h"
41 #include "core/inspector/InstrumentingAgents.h" 41 #include "core/inspector/InstrumentingAgents.h"
42 #include "platform/JSONValues.h" 42 #include "platform/inspector_protocol/Values.h"
43 #include "platform/v8_inspector/public/V8DebuggerAgent.h" 43 #include "platform/v8_inspector/public/V8DebuggerAgent.h"
44 #include "platform/v8_inspector/public/V8EventListenerInfo.h" 44 #include "platform/v8_inspector/public/V8EventListenerInfo.h"
45 #include "platform/v8_inspector/public/V8RuntimeAgent.h" 45 #include "platform/v8_inspector/public/V8RuntimeAgent.h"
46 46
47 namespace { 47 namespace {
48 48
49 enum DOMBreakpointType { 49 enum DOMBreakpointType {
50 SubtreeModified = 0, 50 SubtreeModified = 0,
51 AttributeModified, 51 AttributeModified,
52 NodeRemoved, 52 NodeRemoved,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, c onst String& eventName, const Maybe<String>& targetName) 172 void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString* error, c onst String& eventName, const Maybe<String>& targetName)
173 { 173 {
174 setBreakpoint(error, String(listenerEventCategoryType) + eventName, targetNa me.fromMaybe(String())); 174 setBreakpoint(error, String(listenerEventCategoryType) + eventName, targetNa me.fromMaybe(String()));
175 } 175 }
176 176
177 void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString* error, const String& eventName) 177 void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString* error, const String& eventName)
178 { 178 {
179 setBreakpoint(error, String(instrumentationEventCategoryType) + eventName, S tring()); 179 setBreakpoint(error, String(instrumentationEventCategoryType) + eventName, S tring());
180 } 180 }
181 181
182 static PassRefPtr<JSONObject> ensurePropertyObject(PassRefPtr<JSONObject> object , const String& propertyName) 182 static PassRefPtr<protocol::DictionaryValue> ensurePropertyObject(PassRefPtr<pro tocol::DictionaryValue> object, const String& propertyName)
183 { 183 {
184 JSONObject::iterator it = object->find(propertyName); 184 protocol::DictionaryValue::iterator it = object->find(propertyName);
185 if (it != object->end()) 185 if (it != object->end())
186 return JSONObject::cast(it->value); 186 return protocol::DictionaryValue::cast(it->value);
187 187
188 RefPtr<JSONObject> result = JSONObject::create(); 188 RefPtr<protocol::DictionaryValue> result = protocol::DictionaryValue::create ();
189 object->setObject(propertyName, result); 189 object->setObject(propertyName, result);
190 return result.release(); 190 return result.release();
191 } 191 }
192 192
193 PassRefPtr<JSONObject> InspectorDOMDebuggerAgent::eventListenerBreakpoints() 193 PassRefPtr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::eventListenerBr eakpoints()
194 { 194 {
195 RefPtr<JSONObject> breakpoints = m_state->getObject(DOMDebuggerAgentState::e ventListenerBreakpoints); 195 RefPtr<protocol::DictionaryValue> breakpoints = m_state->getObject(DOMDebugg erAgentState::eventListenerBreakpoints);
196 if (!breakpoints) { 196 if (!breakpoints) {
197 breakpoints = JSONObject::create(); 197 breakpoints = protocol::DictionaryValue::create();
198 m_state->setObject(DOMDebuggerAgentState::eventListenerBreakpoints, brea kpoints); 198 m_state->setObject(DOMDebuggerAgentState::eventListenerBreakpoints, brea kpoints);
199 } 199 }
200 return breakpoints; 200 return breakpoints;
201 } 201 }
202 202
203 PassRefPtr<JSONObject> InspectorDOMDebuggerAgent::xhrBreakpoints() 203 PassRefPtr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::xhrBreakpoints( )
204 { 204 {
205 RefPtr<JSONObject> breakpoints = m_state->getObject(DOMDebuggerAgentState::x hrBreakpoints); 205 RefPtr<protocol::DictionaryValue> breakpoints = m_state->getObject(DOMDebugg erAgentState::xhrBreakpoints);
206 if (!breakpoints) { 206 if (!breakpoints) {
207 breakpoints = JSONObject::create(); 207 breakpoints = protocol::DictionaryValue::create();
208 m_state->setObject(DOMDebuggerAgentState::xhrBreakpoints, breakpoints); 208 m_state->setObject(DOMDebuggerAgentState::xhrBreakpoints, breakpoints);
209 } 209 }
210 return breakpoints; 210 return breakpoints;
211 } 211 }
212 212
213 void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString* error, const String& eventName, const String& targetName) 213 void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString* error, const String& eventName, const String& targetName)
214 { 214 {
215 if (eventName.isEmpty()) { 215 if (eventName.isEmpty()) {
216 *error = "Event name is empty"; 216 *error = "Event name is empty";
217 return; 217 return;
218 } 218 }
219 219
220 RefPtr<JSONObject> breakpointsByTarget = ensurePropertyObject(eventListenerB reakpoints(), eventName); 220 RefPtr<protocol::DictionaryValue> breakpointsByTarget = ensurePropertyObject (eventListenerBreakpoints(), eventName);
221 if (targetName.isEmpty()) 221 if (targetName.isEmpty())
222 breakpointsByTarget->setBoolean(DOMDebuggerAgentState::eventTargetAny, t rue); 222 breakpointsByTarget->setBoolean(DOMDebuggerAgentState::eventTargetAny, t rue);
223 else 223 else
224 breakpointsByTarget->setBoolean(targetName.lower(), true); 224 breakpointsByTarget->setBoolean(targetName.lower(), true);
225 didAddBreakpoint(); 225 didAddBreakpoint();
226 } 226 }
227 227
228 void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error , const String& eventName, const Maybe<String>& targetName) 228 void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString* error , const String& eventName, const Maybe<String>& targetName)
229 { 229 {
230 removeBreakpoint(error, String(listenerEventCategoryType) + eventName, targe tName.fromMaybe(String())); 230 removeBreakpoint(error, String(listenerEventCategoryType) + eventName, targe tName.fromMaybe(String()));
231 } 231 }
232 232
233 void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString* err or, const String& eventName) 233 void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString* err or, const String& eventName)
234 { 234 {
235 removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName , String()); 235 removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName , String());
236 } 236 }
237 237
238 void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString* error, const Strin g& eventName, const String& targetName) 238 void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString* error, const Strin g& eventName, const String& targetName)
239 { 239 {
240 if (eventName.isEmpty()) { 240 if (eventName.isEmpty()) {
241 *error = "Event name is empty"; 241 *error = "Event name is empty";
242 return; 242 return;
243 } 243 }
244 244
245 RefPtr<JSONObject> breakpointsByTarget = ensurePropertyObject(eventListenerB reakpoints(), eventName); 245 RefPtr<protocol::DictionaryValue> breakpointsByTarget = ensurePropertyObject (eventListenerBreakpoints(), eventName);
246 if (targetName.isEmpty()) 246 if (targetName.isEmpty())
247 breakpointsByTarget->remove(DOMDebuggerAgentState::eventTargetAny); 247 breakpointsByTarget->remove(DOMDebuggerAgentState::eventTargetAny);
248 else 248 else
249 breakpointsByTarget->remove(targetName.lower()); 249 breakpointsByTarget->remove(targetName.lower());
250 didRemoveBreakpoint(); 250 didRemoveBreakpoint();
251 } 251 }
252 252
253 void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node) 253 void InspectorDOMDebuggerAgent::didInvalidateStyleAttr(Node* node)
254 { 254 {
255 if (hasBreakpoint(node, AttributeModified)) { 255 if (hasBreakpoint(node, AttributeModified)) {
256 RefPtr<JSONObject> eventData = JSONObject::create(); 256 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue: :create();
257 descriptionForDOMEvent(node, AttributeModified, false, eventData.get()); 257 descriptionForDOMEvent(node, AttributeModified, false, eventData.get());
258 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release()); 258 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release());
259 } 259 }
260 } 260 }
261 261
262 void InspectorDOMDebuggerAgent::didInsertDOMNode(Node* node) 262 void InspectorDOMDebuggerAgent::didInsertDOMNode(Node* node)
263 { 263 {
264 if (m_domBreakpoints.size()) { 264 if (m_domBreakpoints.size()) {
265 uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode( node)); 265 uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode( node));
266 uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTyp eShift)) & inheritableDOMBreakpointTypesMask; 266 uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTyp eShift)) & inheritableDOMBreakpointTypesMask;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (!objectGroupId.isEmpty()) { 416 if (!objectGroupId.isEmpty()) {
417 value->setHandler(m_runtimeAgent->wrapObject(context, function, objectGr oupId)); 417 value->setHandler(m_runtimeAgent->wrapObject(context, function, objectGr oupId));
418 value->setOriginalHandler(m_runtimeAgent->wrapObject(context, info.handl er, objectGroupId)); 418 value->setOriginalHandler(m_runtimeAgent->wrapObject(context, info.handl er, objectGroupId));
419 } 419 }
420 return value.release(); 420 return value.release();
421 } 421 }
422 422
423 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent) 423 void InspectorDOMDebuggerAgent::willInsertDOMNode(Node* parent)
424 { 424 {
425 if (hasBreakpoint(parent, SubtreeModified)) { 425 if (hasBreakpoint(parent, SubtreeModified)) {
426 RefPtr<JSONObject> eventData = JSONObject::create(); 426 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue: :create();
427 descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get()); 427 descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get());
428 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release()); 428 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release());
429 } 429 }
430 } 430 }
431 431
432 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node) 432 void InspectorDOMDebuggerAgent::willRemoveDOMNode(Node* node)
433 { 433 {
434 Node* parentNode = InspectorDOMAgent::innerParentNode(node); 434 Node* parentNode = InspectorDOMAgent::innerParentNode(node);
435 if (hasBreakpoint(node, NodeRemoved)) { 435 if (hasBreakpoint(node, NodeRemoved)) {
436 RefPtr<JSONObject> eventData = JSONObject::create(); 436 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue: :create();
437 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); 437 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get());
438 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release()); 438 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release());
439 } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { 439 } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) {
440 RefPtr<JSONObject> eventData = JSONObject::create(); 440 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue: :create();
441 descriptionForDOMEvent(node, SubtreeModified, false, eventData.get()); 441 descriptionForDOMEvent(node, SubtreeModified, false, eventData.get());
442 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release()); 442 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release());
443 } 443 }
444 didRemoveDOMNode(node); 444 didRemoveDOMNode(node);
445 } 445 }
446 446
447 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic String&, const AtomicString&) 447 void InspectorDOMDebuggerAgent::willModifyDOMAttr(Element* element, const Atomic String&, const AtomicString&)
448 { 448 {
449 if (hasBreakpoint(element, AttributeModified)) { 449 if (hasBreakpoint(element, AttributeModified)) {
450 RefPtr<JSONObject> eventData = JSONObject::create(); 450 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue: :create();
451 descriptionForDOMEvent(element, AttributeModified, false, eventData.get( )); 451 descriptionForDOMEvent(element, AttributeModified, false, eventData.get( ));
452 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release()); 452 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::DO M, eventData.release());
453 } 453 }
454 } 454 }
455 455
456 void InspectorDOMDebuggerAgent::willSetInnerHTML() 456 void InspectorDOMDebuggerAgent::willSetInnerHTML()
457 { 457 {
458 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(setInnerHTMLEventNa me, 0), true); 458 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(setInnerHTMLEventNa me, 0), true);
459 } 459 }
460 460
461 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo intType, bool insertion, JSONObject* description) 461 void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo intType, bool insertion, protocol::DictionaryValue* description)
462 { 462 {
463 ASSERT(hasBreakpoint(target, breakpointType)); 463 ASSERT(hasBreakpoint(target, breakpointType));
464 464
465 Node* breakpointOwner = target; 465 Node* breakpointOwner = target;
466 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { 466 if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) {
467 // For inheritable breakpoint types, target node isn't always the same a s the node that owns a breakpoint. 467 // For inheritable breakpoint types, target node isn't always the same a s the node that owns a breakpoint.
468 // Target node may be unknown to frontend, so we need to push it first. 468 // Target node may be unknown to frontend, so we need to push it first.
469 OwnPtr<protocol::Runtime::RemoteObject> targetNodeObject = m_domAgent->r esolveNode(target, V8DebuggerAgent::backtraceObjectGroup); 469 OwnPtr<protocol::Runtime::RemoteObject> targetNodeObject = m_domAgent->r esolveNode(target, V8DebuggerAgent::backtraceObjectGroup);
470 description->setValue("targetNode", targetNodeObject->serialize()); 470 description->setValue("targetNode", targetNodeObject->serialize());
471 471
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 m_domBreakpoints.remove(node); 510 m_domBreakpoints.remove(node);
511 511
512 uint32_t newRootMask = rootMask & ~newMask; 512 uint32_t newRootMask = rootMask & ~newMask;
513 if (!newRootMask) 513 if (!newRootMask)
514 return; 514 return;
515 515
516 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child = InspectorDOMAgent::innerNextSibling(child)) 516 for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child = InspectorDOMAgent::innerNextSibling(child))
517 updateSubtreeBreakpoints(child, newRootMask, set); 517 updateSubtreeBreakpoints(child, newRootMask, set);
518 } 518 }
519 519
520 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(PassRefPtr<JSONObject > eventData, bool synchronous) 520 void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(PassRefPtr<protocol:: DictionaryValue> eventData, bool synchronous)
521 { 521 {
522 if (!eventData) 522 if (!eventData)
523 return; 523 return;
524 if (!m_debuggerAgent->enabled()) 524 if (!m_debuggerAgent->enabled())
525 return; 525 return;
526 if (synchronous) 526 if (synchronous)
527 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::Ev entListener, eventData); 527 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::Ev entListener, eventData);
528 else 528 else
529 m_debuggerAgent->schedulePauseOnNextStatement(protocol::Debugger::Paused ::ReasonEnum::EventListener, eventData); 529 m_debuggerAgent->schedulePauseOnNextStatement(protocol::Debugger::Paused ::ReasonEnum::EventListener, eventData);
530 } 530 }
531 531
532 PassRefPtr<JSONObject> InspectorDOMDebuggerAgent::preparePauseOnNativeEventData( const String& eventName, const String* targetName) 532 PassRefPtr<protocol::DictionaryValue> InspectorDOMDebuggerAgent::preparePauseOnN ativeEventData(const String& eventName, const String* targetName)
533 { 533 {
534 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta tionEventCategoryType) + eventName; 534 String fullEventName = (targetName ? listenerEventCategoryType : instrumenta tionEventCategoryType) + eventName;
535 RefPtr<JSONObject> breakpoints = eventListenerBreakpoints(); 535 RefPtr<protocol::DictionaryValue> breakpoints = eventListenerBreakpoints();
536 JSONObject::iterator it = breakpoints->find(fullEventName); 536 protocol::DictionaryValue::iterator it = breakpoints->find(fullEventName);
537 if (it == breakpoints->end()) 537 if (it == breakpoints->end())
538 return nullptr; 538 return nullptr;
539 bool match = false; 539 bool match = false;
540 RefPtr<JSONObject> breakpointsByTarget = JSONObject::cast(it->value); 540 RefPtr<protocol::DictionaryValue> breakpointsByTarget = protocol::Dictionary Value::cast(it->value);
541 breakpointsByTarget->getBoolean(DOMDebuggerAgentState::eventTargetAny, &matc h); 541 breakpointsByTarget->getBoolean(DOMDebuggerAgentState::eventTargetAny, &matc h);
542 if (!match && targetName) 542 if (!match && targetName)
543 breakpointsByTarget->getBoolean(targetName->lower(), &match); 543 breakpointsByTarget->getBoolean(targetName->lower(), &match);
544 if (!match) 544 if (!match)
545 return nullptr; 545 return nullptr;
546 546
547 RefPtr<JSONObject> eventData = JSONObject::create(); 547 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::cre ate();
548 eventData->setString("eventName", fullEventName); 548 eventData->setString("eventName", fullEventName);
549 if (targetName) 549 if (targetName)
550 eventData->setString("targetName", *targetName); 550 eventData->setString("targetName", *targetName);
551 return eventData.release(); 551 return eventData.release();
552 } 552 }
553 553
554 void InspectorDOMDebuggerAgent::didInstallTimer(ExecutionContext*, int, int, boo l) 554 void InspectorDOMDebuggerAgent::didInstallTimer(ExecutionContext*, int, int, boo l)
555 { 555 {
556 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(setTimerEventName, 0), true); 556 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(setTimerEventName, 0), true);
557 } 557 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(scriptFirstStatemen tEventName, 0), false); 603 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(scriptFirstStatemen tEventName, 0), false);
604 } 604 }
605 605
606 void InspectorDOMDebuggerAgent::willCloseWindow() 606 void InspectorDOMDebuggerAgent::willCloseWindow()
607 { 607 {
608 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(windowCloseEventNam e, 0), true); 608 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(windowCloseEventNam e, 0), true);
609 } 609 }
610 610
611 void InspectorDOMDebuggerAgent::didFireWebGLError(const String& errorName) 611 void InspectorDOMDebuggerAgent::didFireWebGLError(const String& errorName)
612 { 612 {
613 RefPtr<JSONObject> eventData = preparePauseOnNativeEventData(webglErrorFired EventName, 0); 613 RefPtr<protocol::DictionaryValue> eventData = preparePauseOnNativeEventData( webglErrorFiredEventName, 0);
614 if (!eventData) 614 if (!eventData)
615 return; 615 return;
616 if (!errorName.isEmpty()) 616 if (!errorName.isEmpty())
617 eventData->setString(webglErrorNameProperty, errorName); 617 eventData->setString(webglErrorNameProperty, errorName);
618 pauseOnNativeEventIfNeeded(eventData.release(), m_debuggerAgent->canBreakPro gram()); 618 pauseOnNativeEventIfNeeded(eventData.release(), m_debuggerAgent->canBreakPro gram());
619 } 619 }
620 620
621 void InspectorDOMDebuggerAgent::didFireWebGLWarning() 621 void InspectorDOMDebuggerAgent::didFireWebGLWarning()
622 { 622 {
623 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(webglWarningFiredEv entName, 0), m_debuggerAgent->canBreakProgram()); 623 pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(webglWarningFiredEv entName, 0), m_debuggerAgent->canBreakProgram());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 break; 661 break;
662 } 662 }
663 } 663 }
664 } 664 }
665 665
666 if (breakpointURL.isNull()) 666 if (breakpointURL.isNull())
667 return; 667 return;
668 if (!m_debuggerAgent->enabled()) 668 if (!m_debuggerAgent->enabled())
669 return; 669 return;
670 670
671 RefPtr<JSONObject> eventData = JSONObject::create(); 671 RefPtr<protocol::DictionaryValue> eventData = protocol::DictionaryValue::cre ate();
672 eventData->setString("breakpointURL", breakpointURL); 672 eventData->setString("breakpointURL", breakpointURL);
673 eventData->setString("url", url); 673 eventData->setString("url", url);
674 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::XHR, e ventData.release()); 674 m_debuggerAgent->breakProgram(protocol::Debugger::Paused::ReasonEnum::XHR, e ventData.release());
675 } 675 }
676 676
677 void InspectorDOMDebuggerAgent::didAddBreakpoint() 677 void InspectorDOMDebuggerAgent::didAddBreakpoint()
678 { 678 {
679 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false)) 679 if (m_state->booleanProperty(DOMDebuggerAgentState::enabled, false))
680 return; 680 return;
681 setEnabled(true); 681 setEnabled(true);
682 } 682 }
683 683
684 static bool isEmpty(PassRefPtr<JSONObject> object) 684 static bool isEmpty(PassRefPtr<protocol::DictionaryValue> object)
685 { 685 {
686 return object->begin() == object->end(); 686 return object->begin() == object->end();
687 } 687 }
688 688
689 void InspectorDOMDebuggerAgent::didRemoveBreakpoint() 689 void InspectorDOMDebuggerAgent::didRemoveBreakpoint()
690 { 690 {
691 if (!m_domBreakpoints.isEmpty()) 691 if (!m_domBreakpoints.isEmpty())
692 return; 692 return;
693 if (!isEmpty(eventListenerBreakpoints())) 693 if (!isEmpty(eventListenerBreakpoints()))
694 return; 694 return;
(...skipping 14 matching lines...) Expand all
709 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr); 709 m_instrumentingAgents->setInspectorDOMDebuggerAgent(nullptr);
710 } 710 }
711 } 711 }
712 712
713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*) 713 void InspectorDOMDebuggerAgent::didCommitLoadForLocalFrame(LocalFrame*)
714 { 714 {
715 m_domBreakpoints.clear(); 715 m_domBreakpoints.clear();
716 } 716 }
717 717
718 } // namespace blink 718 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698