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

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

Issue 1728873002: DevTools: simplify JSONValues API, prepare to the OwnPtr migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselines 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<JSONObject> ensurePropertyObject(PassRefPtr<JSONObject> object , const String& propertyName)
183 { 183 {
184 JSONObject::iterator it = object->find(propertyName); 184 JSONObject::iterator it = object->find(propertyName);
185 if (it != object->end()) 185 if (it != object->end())
186 return it->value->asObject(); 186 return JSONObject::cast(it->value);
187 187
188 RefPtr<JSONObject> result = JSONObject::create(); 188 RefPtr<JSONObject> result = JSONObject::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<JSONObject> InspectorDOMDebuggerAgent::eventListenerBreakpoints()
194 { 194 {
195 RefPtr<JSONObject> breakpoints = m_state->getObject(DOMDebuggerAgentState::e ventListenerBreakpoints); 195 RefPtr<JSONObject> breakpoints = m_state->getObject(DOMDebuggerAgentState::e ventListenerBreakpoints);
196 if (!breakpoints) { 196 if (!breakpoints) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 531
532 PassRefPtr<JSONObject> InspectorDOMDebuggerAgent::preparePauseOnNativeEventData( const String& eventName, const String* targetName) 532 PassRefPtr<JSONObject> InspectorDOMDebuggerAgent::preparePauseOnNativeEventData( 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<JSONObject> breakpoints = eventListenerBreakpoints();
536 JSONObject::iterator it = breakpoints->find(fullEventName); 536 JSONObject::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 = it->value->asObject(); 540 RefPtr<JSONObject> breakpointsByTarget = JSONObject::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<JSONObject> eventData = JSONObject::create();
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);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorBaseAgent.cpp ('k') | third_party/WebKit/Source/platform/JSONParserTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698