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

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

Issue 800113002: Use C++11 range-based for loop in Source/core/inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: REBASE AGAIN! Created 6 years 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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints); 362 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints);
363 if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end()) { 363 if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end()) {
364 *errorString = "Breakpoint at specified location already exists."; 364 *errorString = "Breakpoint at specified location already exists.";
365 return; 365 return;
366 } 366 }
367 367
368 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex)); 368 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex));
369 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie); 369 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie);
370 370
371 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); 371 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
372 for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++i t) { 372 for (auto it : m_scripts) {
373 if (!matches(it->value.sourceURL(), url, isRegex)) 373 if (!matches(it.value.sourceURL(), url, isRegex))
374 continue; 374 continue;
375 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(bre akpointId, it->key, breakpoint, UserBreakpointSource); 375 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(bre akpointId, it.key, breakpoint, UserBreakpointSource);
376 if (location) 376 if (location)
377 locations->addItem(location); 377 locations->addItem(location);
378 } 378 }
379 379
380 *outBreakpointId = breakpointId; 380 *outBreakpointId = breakpointId;
381 } 381 }
382 382
383 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat ion, String* scriptId, int* lineNumber, int* columnNumber) 383 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat ion, String* scriptId, int* lineNumber, int* columnNumber)
384 { 384 {
385 if (!location->getString("scriptId", scriptId) || !location->getNumber("line Number", lineNumber)) { 385 if (!location->getString("scriptId", scriptId) || !location->getNumber("line Number", lineNumber)) {
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine(), script .startColumn(), script.endLine(), script.endColumn(), isContentScriptParam, sour ceMapURLParam, hasSourceURLParam); 1312 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine(), script .startColumn(), script.endLine(), script.endColumn(), isContentScriptParam, sour ceMapURLParam, hasSourceURLParam);
1313 else 1313 else
1314 m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine(), script.startColumn(), script.endLine(), script.endColumn(), isContentScriptPara m, sourceMapURLParam, hasSourceURLParam); 1314 m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine(), script.startColumn(), script.endLine(), script.endColumn(), isContentScriptPara m, sourceMapURLParam, hasSourceURLParam);
1315 1315
1316 m_scripts.set(scriptId, script); 1316 m_scripts.set(scriptId, script);
1317 1317
1318 if (scriptURL.isEmpty() || hasSyntaxError) 1318 if (scriptURL.isEmpty() || hasSyntaxError)
1319 return; 1319 return;
1320 1320
1321 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints); 1321 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState ::javaScriptBreakpoints);
1322 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints Cookie->end(); ++it) { 1322 for (auto it : *breakpointsCookie) {
1323 RefPtr<JSONObject> breakpointObject = it->value->asObject(); 1323 RefPtr<JSONObject> breakpointObject = it.value->asObject();
1324 bool isRegex; 1324 bool isRegex;
1325 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); 1325 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
1326 String url; 1326 String url;
1327 breakpointObject->getString(DebuggerAgentState::url, &url); 1327 breakpointObject->getString(DebuggerAgentState::url, &url);
1328 if (!matches(scriptURL, url, isRegex)) 1328 if (!matches(scriptURL, url, isRegex))
1329 continue; 1329 continue;
1330 ScriptBreakpoint breakpoint; 1330 ScriptBreakpoint breakpoint;
1331 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); 1331 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber);
1332 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); 1332 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber);
1333 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); 1333 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition);
1334 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it- >key, scriptId, breakpoint, UserBreakpointSource); 1334 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it. key, scriptId, breakpoint, UserBreakpointSource);
1335 if (location) 1335 if (location)
1336 m_frontend->breakpointResolved(it->key, location); 1336 m_frontend->breakpointResolved(it.key, location);
1337 } 1337 }
1338 } 1338 }
1339 1339
1340 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co nst Vector<String>& hitBreakpoints, bool isPromiseRejection) 1340 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co nst Vector<String>& hitBreakpoints, bool isPromiseRejection)
1341 { 1341 {
1342 ScriptDebugListener::SkipPauseRequest result; 1342 ScriptDebugListener::SkipPauseRequest result;
1343 if (callFrames.isEmpty()) 1343 if (callFrames.isEmpty())
1344 result = ScriptDebugListener::Continue; // Skip pauses inside V8 interna l scripts and on syntax errors. 1344 result = ScriptDebugListener::Continue; // Skip pauses inside V8 interna l scripts and on syntax errors.
1345 else if (m_skipAllPauses) 1345 else if (m_skipAllPauses)
1346 result = ScriptDebugListener::Continue; 1346 result = ScriptDebugListener::Continue;
(...skipping 19 matching lines...) Expand all
1366 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState); 1366 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState);
1367 if (!injectedScript.isEmpty()) { 1367 if (!injectedScript.isEmpty()) {
1368 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception; 1368 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception;
1369 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug gerAgent::backtraceObjectGroup)->openAccessors(); 1369 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug gerAgent::backtraceObjectGroup)->openAccessors();
1370 // m_breakAuxData might be null after this. 1370 // m_breakAuxData might be null after this.
1371 } 1371 }
1372 } 1372 }
1373 1373
1374 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); 1374 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create();
1375 1375
1376 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea kpoints.end(); ++i) { 1376 for (const auto& i : hitBreakpoints) {
1377 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(*i); 1377 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(i);
1378 if (breakpointIterator != m_serverBreakpoints.end()) { 1378 if (breakpointIterator != m_serverBreakpoints.end()) {
1379 const String& localId = breakpointIterator->value.first; 1379 const String& localId = breakpointIterator->value.first;
1380 hitBreakpointIds->addItem(localId); 1380 hitBreakpointIds->addItem(localId);
1381 1381
1382 BreakpointSource source = breakpointIterator->value.second; 1382 BreakpointSource source = breakpointIterator->value.second;
1383 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s ource == DebugCommandBreakpointSource) 1383 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s ource == DebugCommandBreakpointSource)
1384 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman d; 1384 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman d;
1385 } 1385 }
1386 } 1386 }
1387 1387
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 visitor->trace(m_listener); 1500 visitor->trace(m_listener);
1501 visitor->trace(m_asyncCallStackTracker); 1501 visitor->trace(m_asyncCallStackTracker);
1502 #if ENABLE(OILPAN) 1502 #if ENABLE(OILPAN)
1503 visitor->trace(m_promiseTracker); 1503 visitor->trace(m_promiseTracker);
1504 visitor->trace(m_asyncOperationsForStepInto); 1504 visitor->trace(m_asyncOperationsForStepInto);
1505 #endif 1505 #endif
1506 InspectorBaseAgent::trace(visitor); 1506 InspectorBaseAgent::trace(visitor);
1507 } 1507 }
1508 1508
1509 } // namespace blink 1509 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698