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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp

Issue 2087953004: Switch v8 inspector to stl collections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/inspector_protocol/Values.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InspectedContext.h" 10 #include "platform/v8_inspector/InspectedContext.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 void V8DebuggerAgentImpl::enable() 185 void V8DebuggerAgentImpl::enable()
186 { 186 {
187 // debugger().addListener may result in reporting all parsed scripts to 187 // debugger().addListener may result in reporting all parsed scripts to
188 // the agent so it should already be in enabled state by then. 188 // the agent so it should already be in enabled state by then.
189 m_enabled = true; 189 m_enabled = true;
190 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); 190 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true);
191 debugger().debuggerAgentEnabled(); 191 debugger().debuggerAgentEnabled();
192 192
193 protocol::Vector<V8DebuggerParsedScript> compiledScripts; 193 std::vector<V8DebuggerParsedScript> compiledScripts;
194 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts); 194 debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts);
195 for (size_t i = 0; i < compiledScripts.size(); i++) 195 for (size_t i = 0; i < compiledScripts.size(); i++)
196 didParseSource(compiledScripts[i]); 196 didParseSource(compiledScripts[i]);
197 197
198 // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends 198 // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
199 debugger().setBreakpointsActivated(true); 199 debugger().setBreakpointsActivated(true);
200 m_session->changeInstrumentationCounter(+1); 200 m_session->changeInstrumentationCounter(+1);
201 } 201 }
202 202
203 bool V8DebuggerAgentImpl::enabled() 203 bool V8DebuggerAgentImpl::enabled()
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, std::move( newValue)); 351 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, std::move( newValue));
352 } 352 }
353 if (breakpointsCookie->get(breakpointId)) { 353 if (breakpointsCookie->get(breakpointId)) {
354 *errorString = "Breakpoint at specified location already exists."; 354 *errorString = "Breakpoint at specified location already exists.";
355 return; 355 return;
356 } 356 }
357 357
358 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex)); 358 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur l, lineNumber, columnNumber, condition, isRegex));
359 359
360 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); 360 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
361 for (auto& script : m_scripts) { 361 for (const auto& script : m_scripts) {
362 if (!matches(m_debugger, script.second->sourceURL(), url, isRegex)) 362 if (!matches(m_debugger, script.second.sourceURL(), url, isRegex))
363 continue; 363 continue;
364 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoi nt(breakpointId, script.first, breakpoint, UserBreakpointSource); 364 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoi nt(breakpointId, script.first, breakpoint, UserBreakpointSource);
365 if (location) 365 if (location)
366 (*locations)->addItem(std::move(location)); 366 (*locations)->addItem(std::move(location));
367 } 367 }
368 368
369 *outBreakpointId = breakpointId; 369 *outBreakpointId = breakpointId;
370 } 370 }
371 371
372 static bool parseLocation(ErrorString* errorString, std::unique_ptr<protocol::De bugger::Location> location, String16* scriptId, int* lineNumber, int* columnNumb er) 372 static bool parseLocation(ErrorString* errorString, std::unique_ptr<protocol::De bugger::Location> location, String16* scriptId, int* lineNumber, int* columnNumb er)
(...skipping 13 matching lines...) Expand all
386 String16 scriptId; 386 String16 scriptId;
387 int lineNumber; 387 int lineNumber;
388 int columnNumber; 388 int columnNumber;
389 389
390 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber, &columnNumber)) 390 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber, &columnNumber))
391 return; 391 return;
392 392
393 String16 condition = optionalCondition.fromMaybe(""); 393 String16 condition = optionalCondition.fromMaybe("");
394 394
395 String16 breakpointId = generateBreakpointId(scriptId, lineNumber, columnNum ber, UserBreakpointSource); 395 String16 breakpointId = generateBreakpointId(scriptId, lineNumber, columnNum ber, UserBreakpointSource);
396 if (m_breakpointIdToDebuggerBreakpointIds.contains(breakpointId)) { 396 if (m_breakpointIdToDebuggerBreakpointIds.find(breakpointId) != m_breakpoint IdToDebuggerBreakpointIds.end()) {
397 *errorString = "Breakpoint at specified location already exists."; 397 *errorString = "Breakpoint at specified location already exists.";
398 return; 398 return;
399 } 399 }
400 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); 400 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
401 *actualLocation = resolveBreakpoint(breakpointId, scriptId, breakpoint, User BreakpointSource); 401 *actualLocation = resolveBreakpoint(breakpointId, scriptId, breakpoint, User BreakpointSource);
402 if (*actualLocation) 402 if (*actualLocation)
403 *outBreakpointId = breakpointId; 403 *outBreakpointId = breakpointId;
404 else 404 else
405 *errorString = "Could not resolve breakpoint"; 405 *errorString = "Could not resolve breakpoint";
406 } 406 }
407 407
408 void V8DebuggerAgentImpl::removeBreakpoint(ErrorString* errorString, const Strin g16& breakpointId) 408 void V8DebuggerAgentImpl::removeBreakpoint(ErrorString* errorString, const Strin g16& breakpointId)
409 { 409 {
410 if (!checkEnabled(errorString)) 410 if (!checkEnabled(errorString))
411 return; 411 return;
412 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints); 412 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints);
413 if (breakpointsCookie) 413 if (breakpointsCookie)
414 breakpointsCookie->remove(breakpointId); 414 breakpointsCookie->remove(breakpointId);
415 removeBreakpoint(breakpointId); 415 removeBreakpoint(breakpointId);
416 } 416 }
417 417
418 void V8DebuggerAgentImpl::removeBreakpoint(const String16& breakpointId) 418 void V8DebuggerAgentImpl::removeBreakpoint(const String16& breakpointId)
419 { 419 {
420 DCHECK(enabled()); 420 DCHECK(enabled());
421 BreakpointIdToDebuggerBreakpointIdsMap::iterator debuggerBreakpointIdsIterat or = m_breakpointIdToDebuggerBreakpointIds.find(breakpointId); 421 BreakpointIdToDebuggerBreakpointIdsMap::iterator debuggerBreakpointIdsIterat or = m_breakpointIdToDebuggerBreakpointIds.find(breakpointId);
422 if (debuggerBreakpointIdsIterator == m_breakpointIdToDebuggerBreakpointIds.e nd()) 422 if (debuggerBreakpointIdsIterator == m_breakpointIdToDebuggerBreakpointIds.e nd())
423 return; 423 return;
424 protocol::Vector<String16>* ids = debuggerBreakpointIdsIterator->second; 424 const std::vector<String16>& ids = debuggerBreakpointIdsIterator->second;
425 for (size_t i = 0; i < ids->size(); ++i) { 425 for (size_t i = 0; i < ids.size(); ++i) {
426 const String16& debuggerBreakpointId = ids->at(i); 426 const String16& debuggerBreakpointId = ids[i];
427 427
428 debugger().removeBreakpoint(debuggerBreakpointId); 428 debugger().removeBreakpoint(debuggerBreakpointId);
429 m_serverBreakpoints.remove(debuggerBreakpointId); 429 m_serverBreakpoints.erase(debuggerBreakpointId);
430 } 430 }
431 m_breakpointIdToDebuggerBreakpointIds.remove(breakpointId); 431 m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId);
432 } 432 }
433 433
434 void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, 434 void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString,
435 std::unique_ptr<protocol::Debugger::Location> location, 435 std::unique_ptr<protocol::Debugger::Location> location,
436 const protocol::Maybe<bool>& interstateLocationOpt) 436 const protocol::Maybe<bool>& interstateLocationOpt)
437 { 437 {
438 if (!checkEnabled(errorString)) 438 if (!checkEnabled(errorString))
439 return; 439 return;
440 if (!m_continueToLocationBreakpointId.isEmpty()) { 440 if (!m_continueToLocationBreakpointId.isEmpty()) {
441 debugger().removeBreakpoint(m_continueToLocationBreakpointId); 441 debugger().removeBreakpoint(m_continueToLocationBreakpointId);
442 m_continueToLocationBreakpointId = ""; 442 m_continueToLocationBreakpointId = "";
443 } 443 }
444 444
445 String16 scriptId; 445 String16 scriptId;
446 int lineNumber; 446 int lineNumber;
447 int columnNumber; 447 int columnNumber;
448 448
449 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber, &columnNumber)) 449 if (!parseLocation(errorString, std::move(location), &scriptId, &lineNumber, &columnNumber))
450 return; 450 return;
451 451
452 ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); 452 ScriptBreakpoint breakpoint(lineNumber, columnNumber, "");
453 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); 453 m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakp oint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false));
454 resume(errorString); 454 resume(errorString);
455 } 455 }
456 456
457 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, std::unique_ptr <Array<CallFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace) 457 void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, std::unique_ptr <Array<CallFrame>>* callFrames, Maybe<StackTrace>* asyncStackTrace)
458 { 458 {
459 if (!assertPaused(errorString)) 459 if (!assertPaused(errorString))
460 return; 460 return;
461 m_pausedCallFrames.swap(debugger().currentCallFrames()); 461 JavaScriptCallFrames frames = debugger().currentCallFrames();
462 m_pausedCallFrames.swap(frames);
462 *callFrames = currentCallFrames(errorString); 463 *callFrames = currentCallFrames(errorString);
463 if (!*callFrames) 464 if (!*callFrames)
464 return; 465 return;
465 *asyncStackTrace = currentAsyncStackTrace(); 466 *asyncStackTrace = currentAsyncStackTrace();
466 } 467 }
467 468
468 bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed() 469 bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed()
469 { 470 {
470 DCHECK(enabled()); 471 DCHECK(enabled());
471 JavaScriptCallFrames callFrames = debugger().currentCallFrames(); 472 JavaScriptCallFrames callFrames = debugger().currentCallFrames();
472 for (size_t index = 0; index < callFrames.size(); ++index) { 473 for (size_t index = 0; index < callFrames.size(); ++index) {
473 if (!isCallFrameWithUnknownScriptOrBlackboxed(callFrames[index])) 474 if (!isCallFrameWithUnknownScriptOrBlackboxed(callFrames[index].get()))
474 return false; 475 return false;
475 } 476 }
476 return true; 477 return true;
477 } 478 }
478 479
479 bool V8DebuggerAgentImpl::isTopPausedCallFrameBlackboxed() 480 bool V8DebuggerAgentImpl::isTopPausedCallFrameBlackboxed()
480 { 481 {
481 DCHECK(enabled()); 482 DCHECK(enabled());
482 return isCallFrameWithUnknownScriptOrBlackboxed(m_pausedCallFrames.size() ? m_pausedCallFrames[0] : nullptr); 483 JavaScriptCallFrame* frame = m_pausedCallFrames.size() ? m_pausedCallFrames[ 0].get() : nullptr;
484 return isCallFrameWithUnknownScriptOrBlackboxed(frame);
483 } 485 }
484 486
485 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame) 487 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame)
486 { 488 {
487 if (!frame) 489 if (!frame)
488 return true; 490 return true;
489 ScriptsMap::iterator it = m_scripts.find(String16::number(frame->sourceID()) ); 491 ScriptsMap::iterator it = m_scripts.find(String16::number(frame->sourceID()) );
490 if (it == m_scripts.end()) { 492 if (it == m_scripts.end()) {
491 // Unknown scripts are blackboxed. 493 // Unknown scripts are blackboxed.
492 return true; 494 return true;
493 } 495 }
494 if (m_blackboxPattern) { 496 if (m_blackboxPattern) {
495 String16 scriptSourceURL = it->second->sourceURL(); 497 const String16& scriptSourceURL = it->second.sourceURL();
496 if (!scriptSourceURL.isEmpty() && m_blackboxPattern->match(scriptSourceU RL) != -1) 498 if (!scriptSourceURL.isEmpty() && m_blackboxPattern->match(scriptSourceU RL) != -1)
497 return true; 499 return true;
498 } 500 }
499 auto itBlackboxedPositions = m_blackboxedPositions.find(String16::number(fra me->sourceID())); 501 auto itBlackboxedPositions = m_blackboxedPositions.find(String16::number(fra me->sourceID()));
500 if (itBlackboxedPositions == m_blackboxedPositions.end()) 502 if (itBlackboxedPositions == m_blackboxedPositions.end())
501 return false; 503 return false;
502 504
503 protocol::Vector<std::pair<int, int>>* ranges = itBlackboxedPositions->secon d; 505 const std::vector<std::pair<int, int>>& ranges = itBlackboxedPositions->seco nd;
504 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa ir(frame->line(), frame->column()), positionComparator); 506 auto itRange = std::lower_bound(ranges.cbegin(), ranges.cend(),
507 std::make_pair(frame->line(), frame->column()), positionComparator);
505 // Ranges array contains positions in script where blackbox state is changed . 508 // Ranges array contains positions in script where blackbox state is changed .
506 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed... 509 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed...
507 return std::distance(ranges->begin(), itRange) % 2; 510 return std::distance(ranges.begin(), itRange) % 2;
508 } 511 }
509 512
510 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use(JavaScriptCallFrame* topCallFrame) 513 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use(JavaScriptCallFrame* topCallFrame)
511 { 514 {
512 if (m_steppingFromFramework) 515 if (m_steppingFromFramework)
513 return RequestNoSkip; 516 return RequestNoSkip;
514 if (isCallFrameWithUnknownScriptOrBlackboxed(topCallFrame)) 517 if (isCallFrameWithUnknownScriptOrBlackboxed(topCallFrame))
515 return RequestContinue; 518 return RequestContinue;
516 return RequestNoSkip; 519 return RequestNoSkip;
517 } 520 }
(...skipping 24 matching lines...) Expand all
542 545
543 std::unique_ptr<protocol::Debugger::Location> V8DebuggerAgentImpl::resolveBreakp oint(const String16& breakpointId, const String16& scriptId, const ScriptBreakpo int& breakpoint, BreakpointSource source) 546 std::unique_ptr<protocol::Debugger::Location> V8DebuggerAgentImpl::resolveBreakp oint(const String16& breakpointId, const String16& scriptId, const ScriptBreakpo int& breakpoint, BreakpointSource source)
544 { 547 {
545 DCHECK(enabled()); 548 DCHECK(enabled());
546 // FIXME: remove these checks once crbug.com/520702 is resolved. 549 // FIXME: remove these checks once crbug.com/520702 is resolved.
547 CHECK(!breakpointId.isEmpty()); 550 CHECK(!breakpointId.isEmpty());
548 CHECK(!scriptId.isEmpty()); 551 CHECK(!scriptId.isEmpty());
549 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); 552 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId);
550 if (scriptIterator == m_scripts.end()) 553 if (scriptIterator == m_scripts.end())
551 return nullptr; 554 return nullptr;
552 V8DebuggerScript* script = scriptIterator->second; 555 const V8DebuggerScript& script = scriptIterator->second;
553 if (breakpoint.lineNumber < script->startLine() || script->endLine() < break point.lineNumber) 556 if (breakpoint.lineNumber < script.startLine() || script.endLine() < breakpo int.lineNumber)
554 return nullptr; 557 return nullptr;
555 558
556 int actualLineNumber; 559 int actualLineNumber;
557 int actualColumnNumber; 560 int actualColumnNumber;
558 String16 debuggerBreakpointId = debugger().setBreakpoint(scriptId, breakpoin t, &actualLineNumber, &actualColumnNumber, false); 561 String16 debuggerBreakpointId = debugger().setBreakpoint(scriptId, breakpoin t, &actualLineNumber, &actualColumnNumber, false);
559 if (debuggerBreakpointId.isEmpty()) 562 if (debuggerBreakpointId.isEmpty())
560 return nullptr; 563 return nullptr;
561 564
562 m_serverBreakpoints.set(debuggerBreakpointId, std::make_pair(breakpointId, s ource)); 565 m_serverBreakpoints[debuggerBreakpointId] = std::make_pair(breakpointId, sou rce);
563 CHECK(!breakpointId.isEmpty()); 566 CHECK(!breakpointId.isEmpty());
564 if (!m_breakpointIdToDebuggerBreakpointIds.contains(breakpointId))
565 m_breakpointIdToDebuggerBreakpointIds.set(breakpointId, protocol::Vector <String16>());
566 567
567 BreakpointIdToDebuggerBreakpointIdsMap::iterator debuggerBreakpointIdsIterat or = m_breakpointIdToDebuggerBreakpointIds.find(breakpointId); 568 m_breakpointIdToDebuggerBreakpointIds[breakpointId].push_back(debuggerBreakp ointId);
568 debuggerBreakpointIdsIterator->second->append(debuggerBreakpointId);
569
570 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber) ; 569 return buildProtocolLocation(scriptId, actualLineNumber, actualColumnNumber) ;
571 } 570 }
572 571
573 void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc riptId, const String16& query, 572 void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc riptId, const String16& query,
574 const Maybe<bool>& optionalCaseSensitive, 573 const Maybe<bool>& optionalCaseSensitive,
575 const Maybe<bool>& optionalIsRegex, 574 const Maybe<bool>& optionalIsRegex,
576 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results) 575 std::unique_ptr<Array<protocol::Debugger::SearchMatch>>* results)
577 { 576 {
578 ScriptsMap::iterator it = m_scripts.find(scriptId); 577 ScriptsMap::iterator it = m_scripts.find(scriptId);
579 if (it != m_scripts.end()) 578 if (it != m_scripts.end())
580 *results = V8ContentSearchUtil::searchInTextByLines(m_session, it->secon d->source(), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.from Maybe(false)); 579 *results = V8ContentSearchUtil::searchInTextByLines(m_session, it->secon d.source(), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromM aybe(false));
581 else 580 else
582 *error = String16("No script for id: " + scriptId); 581 *error = String16("No script for id: " + scriptId);
583 } 582 }
584 583
585 void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, 584 void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString,
586 const String16& scriptId, 585 const String16& scriptId,
587 const String16& newContent, 586 const String16& newContent,
588 const Maybe<bool>& preview, 587 const Maybe<bool>& preview,
589 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames, 588 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* newCallFrames,
590 Maybe<bool>* stackChanged, 589 Maybe<bool>* stackChanged,
591 Maybe<StackTrace>* asyncStackTrace, 590 Maybe<StackTrace>* asyncStackTrace,
592 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError) 591 Maybe<protocol::Debugger::SetScriptSourceError>* optOutCompileError)
593 { 592 {
594 if (!checkEnabled(errorString)) 593 if (!checkEnabled(errorString))
595 return; 594 return;
596 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals e), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) 595 if (!debugger().setScriptSource(scriptId, newContent, preview.fromMaybe(fals e), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged))
597 return; 596 return;
598 597
599 std::unique_ptr<Array<CallFrame>> callFrames = currentCallFrames(errorString ); 598 std::unique_ptr<Array<CallFrame>> callFrames = currentCallFrames(errorString );
600 if (!callFrames) 599 if (!callFrames)
601 return; 600 return;
602 *newCallFrames = std::move(callFrames); 601 *newCallFrames = std::move(callFrames);
603 *asyncStackTrace = currentAsyncStackTrace(); 602 *asyncStackTrace = currentAsyncStackTrace();
604 603
605 ScriptsMap::iterator it = m_scripts.find(scriptId); 604 ScriptsMap::iterator it = m_scripts.find(scriptId);
606 if (it == m_scripts.end()) 605 if (it == m_scripts.end())
607 return; 606 return;
608 it->second->setSource(newContent); 607 it->second.setSource(newContent);
609 } 608 }
610 609
611 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString, 610 void V8DebuggerAgentImpl::restartFrame(ErrorString* errorString,
612 const String16& callFrameId, 611 const String16& callFrameId,
613 std::unique_ptr<Array<CallFrame>>* newCallFrames, 612 std::unique_ptr<Array<CallFrame>>* newCallFrames,
614 Maybe<StackTrace>* asyncStackTrace) 613 Maybe<StackTrace>* asyncStackTrace)
615 { 614 {
616 if (!assertPaused(errorString)) 615 if (!assertPaused(errorString))
617 return; 616 return;
618 InjectedScript::CallFrameScope scope(errorString, m_debugger, m_session->con textGroupId(), callFrameId); 617 InjectedScript::CallFrameScope scope(errorString, m_debugger, m_session->con textGroupId(), callFrameId);
619 if (!scope.initialize()) 618 if (!scope.initialize())
620 return; 619 return;
621 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) { 620 if (scope.frameOrdinal() >= m_pausedCallFrames.size()) {
622 *errorString = "Could not find call frame with given id"; 621 *errorString = "Could not find call frame with given id";
623 return; 622 return;
624 } 623 }
625 624
626 v8::Local<v8::Value> resultValue; 625 v8::Local<v8::Value> resultValue;
627 v8::Local<v8::Boolean> result; 626 v8::Local<v8::Boolean> result;
628 if (!m_pausedCallFrames[scope.frameOrdinal()]->restart().ToLocal(&resultValu e) || scope.tryCatch().HasCaught() || !resultValue->ToBoolean(scope.context()).T oLocal(&result) || !result->Value()) { 627 if (!m_pausedCallFrames[scope.frameOrdinal()]->restart().ToLocal(&resultValu e) || scope.tryCatch().HasCaught() || !resultValue->ToBoolean(scope.context()).T oLocal(&result) || !result->Value()) {
629 *errorString = "Internal error"; 628 *errorString = "Internal error";
630 return; 629 return;
631 } 630 }
632 m_pausedCallFrames.swap(debugger().currentCallFrames()); 631 JavaScriptCallFrames frames = debugger().currentCallFrames();
632 m_pausedCallFrames.swap(frames);
633 633
634 *newCallFrames = currentCallFrames(errorString); 634 *newCallFrames = currentCallFrames(errorString);
635 if (!*newCallFrames) 635 if (!*newCallFrames)
636 return; 636 return;
637 *asyncStackTrace = currentAsyncStackTrace(); 637 *asyncStackTrace = currentAsyncStackTrace();
638 } 638 }
639 639
640 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc riptId, String16* scriptSource) 640 void V8DebuggerAgentImpl::getScriptSource(ErrorString* error, const String16& sc riptId, String16* scriptSource)
641 { 641 {
642 if (!checkEnabled(error)) 642 if (!checkEnabled(error))
643 return; 643 return;
644 ScriptsMap::iterator it = m_scripts.find(scriptId); 644 ScriptsMap::iterator it = m_scripts.find(scriptId);
645 if (it == m_scripts.end()) { 645 if (it == m_scripts.end()) {
646 *error = "No script for id: " + scriptId; 646 *error = "No script for id: " + scriptId;
647 return; 647 return;
648 } 648 }
649 *scriptSource = it->second->source(); 649 *scriptSource = it->second.source();
650 } 650 }
651 651
652 void V8DebuggerAgentImpl::getFunctionDetails(ErrorString* errorString, const Str ing16& functionId, std::unique_ptr<FunctionDetails>* details) 652 void V8DebuggerAgentImpl::getFunctionDetails(ErrorString* errorString, const Str ing16& functionId, std::unique_ptr<FunctionDetails>* details)
653 { 653 {
654 if (!checkEnabled(errorString)) 654 if (!checkEnabled(errorString))
655 return; 655 return;
656 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), functionId); 656 InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contex tGroupId(), functionId);
657 if (!scope.initialize()) 657 if (!scope.initialize())
658 return; 658 return;
659 if (!scope.object()->IsFunction()) { 659 if (!scope.object()->IsFunction()) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 m_steppingFromFramework = false; 802 m_steppingFromFramework = false;
803 m_session->releaseObjectGroup(V8InspectorSession::backtraceObjectGroup); 803 m_session->releaseObjectGroup(V8InspectorSession::backtraceObjectGroup);
804 debugger().continueProgram(); 804 debugger().continueProgram();
805 } 805 }
806 806
807 void V8DebuggerAgentImpl::stepOver(ErrorString* errorString) 807 void V8DebuggerAgentImpl::stepOver(ErrorString* errorString)
808 { 808 {
809 if (!assertPaused(errorString)) 809 if (!assertPaused(errorString))
810 return; 810 return;
811 // StepOver at function return point should fallback to StepInto. 811 // StepOver at function return point should fallback to StepInto.
812 JavaScriptCallFrame* frame = m_pausedCallFrames.size() ? m_pausedCallFrames[ 0] : nullptr; 812 JavaScriptCallFrame* frame = !m_pausedCallFrames.empty() ? m_pausedCallFrame s[0].get() : nullptr;
813 if (frame && frame->isAtReturn()) { 813 if (frame && frame->isAtReturn()) {
814 stepInto(errorString); 814 stepInto(errorString);
815 return; 815 return;
816 } 816 }
817 m_scheduledDebuggerStep = StepOver; 817 m_scheduledDebuggerStep = StepOver;
818 m_steppingFromFramework = isTopPausedCallFrameBlackboxed(); 818 m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
819 m_session->releaseObjectGroup(V8InspectorSession::backtraceObjectGroup); 819 m_session->releaseObjectGroup(V8InspectorSession::backtraceObjectGroup);
820 debugger().stepOverStatement(); 820 debugger().stepOverStatement();
821 } 821 }
822 822
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 { 972 {
973 std::unique_ptr<V8Regex> regex(new V8Regex(m_debugger, pattern, true /** cas eSensitive */, false /** multiline */)); 973 std::unique_ptr<V8Regex> regex(new V8Regex(m_debugger, pattern, true /** cas eSensitive */, false /** multiline */));
974 if (!regex->isValid()) { 974 if (!regex->isValid()) {
975 *errorString = "Pattern parser error: " + regex->errorMessage(); 975 *errorString = "Pattern parser error: " + regex->errorMessage();
976 return false; 976 return false;
977 } 977 }
978 m_blackboxPattern = std::move(regex); 978 m_blackboxPattern = std::move(regex);
979 return true; 979 return true;
980 } 980 }
981 981
982 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16 & scriptId, std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> inPositions) 982 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16 & scriptId,
983 std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> inPosit ions)
983 { 984 {
984 if (!m_scripts.contains(scriptId)) { 985 if (m_scripts.find(scriptId) == m_scripts.end()) {
985 *error = "No script with passed id."; 986 *error = "No script with passed id.";
986 return; 987 return;
987 } 988 }
988 989
989 if (!inPositions->length()) { 990 if (!inPositions->length()) {
990 m_blackboxedPositions.remove(scriptId); 991 m_blackboxedPositions.erase(scriptId);
991 return; 992 return;
992 } 993 }
993 994
994 protocol::Vector<std::pair<int, int>> positions(inPositions->length()); 995 std::vector<std::pair<int, int>> positions;
995 for (size_t i = 0; i < positions.size(); ++i) { 996 positions.reserve(inPositions->length());
997 for (size_t i = 0; i < inPositions->length(); ++i) {
996 protocol::Debugger::ScriptPosition* position = inPositions->get(i); 998 protocol::Debugger::ScriptPosition* position = inPositions->get(i);
997 if (position->getLine() < 0) { 999 if (position->getLine() < 0) {
998 *error = "Position missing 'line' or 'line' < 0."; 1000 *error = "Position missing 'line' or 'line' < 0.";
999 return; 1001 return;
1000 } 1002 }
1001 if (position->getColumn() < 0) { 1003 if (position->getColumn() < 0) {
1002 *error = "Position missing 'column' or 'column' < 0."; 1004 *error = "Position missing 'column' or 'column' < 0.";
1003 return; 1005 return;
1004 } 1006 }
1005 positions[i] = std::make_pair(position->getLine(), position->getColumn() ); 1007 positions.push_back(std::make_pair(position->getLine(), position->getCol umn()));
1006 } 1008 }
1007 1009
1008 for (size_t i = 1; i < positions.size(); ++i) { 1010 for (size_t i = 1; i < positions.size(); ++i) {
1009 if (positions[i - 1].first < positions[i].first) 1011 if (positions[i - 1].first < positions[i].first)
1010 continue; 1012 continue;
1011 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec ond < positions[i].second) 1013 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec ond < positions[i].second)
1012 continue; 1014 continue;
1013 *error = "Input positions array is not sorted or contains duplicate valu es."; 1015 *error = "Input positions array is not sorted or contains duplicate valu es.";
1014 return; 1016 return;
1015 } 1017 }
1016 1018
1017 m_blackboxedPositions.set(scriptId, positions); 1019 m_blackboxedPositions[scriptId] = positions;
1018 } 1020 }
1019 1021
1020 void V8DebuggerAgentImpl::willExecuteScript(int scriptId) 1022 void V8DebuggerAgentImpl::willExecuteScript(int scriptId)
1021 { 1023 {
1022 changeJavaScriptRecursionLevel(+1); 1024 changeJavaScriptRecursionLevel(+1);
1023 // Fast return. 1025 // Fast return.
1024 if (m_scheduledDebuggerStep != StepInto) 1026 if (m_scheduledDebuggerStep != StepInto)
1025 return; 1027 return;
1026 // Skip unknown scripts (e.g. InjectedScript). 1028 // Skip unknown scripts (e.g. InjectedScript).
1027 if (!m_scripts.contains(String16::number(scriptId))) 1029 if (m_scripts.find(String16::number(scriptId)) == m_scripts.end())
1028 return; 1030 return;
1029 schedulePauseOnNextStatementIfSteppingInto(); 1031 schedulePauseOnNextStatementIfSteppingInto();
1030 } 1032 }
1031 1033
1032 void V8DebuggerAgentImpl::didExecuteScript() 1034 void V8DebuggerAgentImpl::didExecuteScript()
1033 { 1035 {
1034 changeJavaScriptRecursionLevel(-1); 1036 changeJavaScriptRecursionLevel(-1);
1035 } 1037 }
1036 1038
1037 void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step) 1039 void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 // Context has been reported as removed while on pause. 1079 // Context has been reported as removed while on pause.
1078 return Array<CallFrame>::create(); 1080 return Array<CallFrame>::create();
1079 } 1081 }
1080 1082
1081 v8::HandleScope handles(m_isolate); 1083 v8::HandleScope handles(m_isolate);
1082 v8::Local<v8::Context> context = topFrameInjectedScript->context()->context( ); 1084 v8::Local<v8::Context> context = topFrameInjectedScript->context()->context( );
1083 v8::Context::Scope contextScope(context); 1085 v8::Context::Scope contextScope(context);
1084 1086
1085 v8::Local<v8::Array> objects = v8::Array::New(m_isolate); 1087 v8::Local<v8::Array> objects = v8::Array::New(m_isolate);
1086 for (size_t frameOrdinal = 0; frameOrdinal < m_pausedCallFrames.size(); ++fr ameOrdinal) { 1088 for (size_t frameOrdinal = 0; frameOrdinal < m_pausedCallFrames.size(); ++fr ameOrdinal) {
1087 JavaScriptCallFrame* currentCallFrame = m_pausedCallFrames[frameOrdinal] ; 1089 const std::unique_ptr<JavaScriptCallFrame>& currentCallFrame = m_pausedC allFrames[frameOrdinal];
1088 1090
1089 v8::Local<v8::Object> details = currentCallFrame->details(); 1091 v8::Local<v8::Object> details = currentCallFrame->details();
1090 if (hasInternalError(errorString, details.IsEmpty())) 1092 if (hasInternalError(errorString, details.IsEmpty()))
1091 return Array<CallFrame>::create(); 1093 return Array<CallFrame>::create();
1092 1094
1093 int contextId = currentCallFrame->contextId(); 1095 int contextId = currentCallFrame->contextId();
1094 InjectedScript* injectedScript = contextId ? m_session->findInjectedScri pt(&ignored, contextId) : nullptr; 1096 InjectedScript* injectedScript = contextId ? m_session->findInjectedScri pt(&ignored, contextId) : nullptr;
1095 if (!injectedScript) 1097 if (!injectedScript)
1096 injectedScript = topFrameInjectedScript; 1098 injectedScript = topFrameInjectedScript;
1097 1099
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr; 1166 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr;
1165 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr; 1167 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr;
1166 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; 1168 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr;
1167 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; 1169 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr;
1168 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr ecatedCommentWasUsed : nullptr; 1170 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr ecatedCommentWasUsed : nullptr;
1169 if (parsedScript.success) 1171 if (parsedScript.success)
1170 m_frontend.scriptParsed(parsedScript.scriptId, scriptURL, script.startLi ne(), script.startColumn(), script.endLine(), script.endColumn(), executionConte xtId, script.hash(), isContentScriptParam, isInternalScriptParam, isLiveEditPara m, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); 1172 m_frontend.scriptParsed(parsedScript.scriptId, scriptURL, script.startLi ne(), script.startColumn(), script.endLine(), script.endColumn(), executionConte xtId, script.hash(), isContentScriptParam, isInternalScriptParam, isLiveEditPara m, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam);
1171 else 1173 else
1172 m_frontend.scriptFailedToParse(parsedScript.scriptId, scriptURL, script. startLine(), script.startColumn(), script.endLine(), script.endColumn(), executi onContextId, script.hash(), isContentScriptParam, isInternalScriptParam, sourceM apURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); 1174 m_frontend.scriptFailedToParse(parsedScript.scriptId, scriptURL, script. startLine(), script.startColumn(), script.endLine(), script.endColumn(), executi onContextId, script.hash(), isContentScriptParam, isInternalScriptParam, sourceM apURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam);
1173 1175
1174 m_scripts.set(parsedScript.scriptId, script); 1176 m_scripts[parsedScript.scriptId] = script;
1175 1177
1176 if (scriptURL.isEmpty() || !parsedScript.success) 1178 if (scriptURL.isEmpty() || !parsedScript.success)
1177 return; 1179 return;
1178 1180
1179 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints); 1181 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints);
1180 if (!breakpointsCookie) 1182 if (!breakpointsCookie)
1181 return; 1183 return;
1182 1184
1183 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { 1185 for (size_t i = 0; i < breakpointsCookie->size(); ++i) {
1184 auto cookie = breakpointsCookie->at(i); 1186 auto cookie = breakpointsCookie->at(i);
1185 protocol::DictionaryValue* breakpointObject = protocol::DictionaryValue: :cast(cookie.second); 1187 protocol::DictionaryValue* breakpointObject = protocol::DictionaryValue: :cast(cookie.second);
1186 bool isRegex; 1188 bool isRegex;
1187 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); 1189 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
1188 String16 url; 1190 String16 url;
1189 breakpointObject->getString(DebuggerAgentState::url, &url); 1191 breakpointObject->getString(DebuggerAgentState::url, &url);
1190 if (!matches(m_debugger, scriptURL, url, isRegex)) 1192 if (!matches(m_debugger, scriptURL, url, isRegex))
1191 continue; 1193 continue;
1192 ScriptBreakpoint breakpoint; 1194 ScriptBreakpoint breakpoint;
1193 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber); 1195 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint. lineNumber);
1194 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber); 1196 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin t.columnNumber);
1195 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition); 1197 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c ondition);
1196 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoi nt(cookie.first, parsedScript.scriptId, breakpoint, UserBreakpointSource); 1198 std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoi nt(cookie.first, parsedScript.scriptId, breakpoint, UserBreakpointSource);
1197 if (location) 1199 if (location)
1198 m_frontend.breakpointResolved(cookie.first, std::move(location)); 1200 m_frontend.breakpointResolved(cookie.first, std::move(location));
1199 } 1201 }
1200 } 1202 }
1201 1203
1202 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8 ::Context> context, v8::Local<v8::Value> exception, const protocol::Vector<Strin g16>& hitBreakpoints, bool isPromiseRejection) 1204 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8 ::Context> context, v8::Local<v8::Value> exception, const std::vector<String16>& hitBreakpoints, bool isPromiseRejection)
1203 { 1205 {
1204 JavaScriptCallFrames callFrames = debugger().currentCallFrames(1); 1206 JavaScriptCallFrames callFrames = debugger().currentCallFrames(1);
1205 JavaScriptCallFrame* topCallFrame = callFrames.size() > 0 ? callFrames[0] : nullptr; 1207 JavaScriptCallFrame* topCallFrame = !callFrames.empty() ? callFrames.begin() ->get() : nullptr;
1206 1208
1207 V8DebuggerAgentImpl::SkipPauseRequest result; 1209 V8DebuggerAgentImpl::SkipPauseRequest result;
1208 if (m_skipAllPauses) 1210 if (m_skipAllPauses)
1209 result = RequestContinue; 1211 result = RequestContinue;
1210 else if (!hitBreakpoints.isEmpty()) 1212 else if (!hitBreakpoints.empty())
1211 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i n frameworks. 1213 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i n frameworks.
1212 else if (!exception.IsEmpty()) 1214 else if (!exception.IsEmpty())
1213 result = shouldSkipExceptionPause(topCallFrame); 1215 result = shouldSkipExceptionPause(topCallFrame);
1214 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || m_pausingOnNativeEvent) 1216 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled || m_pausingOnNativeEvent)
1215 result = shouldSkipStepPause(topCallFrame); 1217 result = shouldSkipStepPause(topCallFrame);
1216 else 1218 else
1217 result = RequestNoSkip; 1219 result = RequestNoSkip;
1218 1220
1219 m_skipNextDebuggerStepOut = false; 1221 m_skipNextDebuggerStepOut = false;
1220 if (result != RequestNoSkip) 1222 if (result != RequestNoSkip)
1221 return result; 1223 return result;
1222 // Skip pauses inside V8 internal scripts and on syntax errors. 1224 // Skip pauses inside V8 internal scripts and on syntax errors.
1223 if (!topCallFrame) 1225 if (!topCallFrame)
1224 return RequestContinue; 1226 return RequestContinue;
1225 1227
1226 DCHECK(m_pausedContext.IsEmpty()); 1228 DCHECK(m_pausedContext.IsEmpty());
1227 m_pausedCallFrames.swap(debugger().currentCallFrames()); 1229 JavaScriptCallFrames frames = debugger().currentCallFrames();
1230 m_pausedCallFrames.swap(frames);
1228 m_pausedContext.Reset(m_isolate, context); 1231 m_pausedContext.Reset(m_isolate, context);
1229 v8::HandleScope handles(m_isolate); 1232 v8::HandleScope handles(m_isolate);
1230 1233
1231 if (!exception.IsEmpty()) { 1234 if (!exception.IsEmpty()) {
1232 ErrorString ignored; 1235 ErrorString ignored;
1233 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored, V8Debugger::contextId(context)); 1236 InjectedScript* injectedScript = m_session->findInjectedScript(&ignored, V8Debugger::contextId(context));
1234 if (injectedScript) { 1237 if (injectedScript) {
1235 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; 1238 m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::Rea sonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception;
1236 ErrorString errorString; 1239 ErrorString errorString;
1237 auto obj = injectedScript->wrapObject(&errorString, exception, V8Ins pectorSession::backtraceObjectGroup); 1240 auto obj = injectedScript->wrapObject(&errorString, exception, V8Ins pectorSession::backtraceObjectGroup);
1238 m_breakAuxData = obj ? obj->serialize() : nullptr; 1241 m_breakAuxData = obj ? obj->serialize() : nullptr;
1239 // m_breakAuxData might be null after this. 1242 // m_breakAuxData might be null after this.
1240 } 1243 }
1241 } 1244 }
1242 1245
1243 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create( ); 1246 std::unique_ptr<Array<String16>> hitBreakpointIds = Array<String16>::create( );
1244 1247
1245 for (const auto& point : hitBreakpoints) { 1248 for (const auto& point : hitBreakpoints) {
1246 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(point); 1249 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(point);
1247 if (breakpointIterator != m_serverBreakpoints.end()) { 1250 if (breakpointIterator != m_serverBreakpoints.end()) {
1248 const String16& localId = breakpointIterator->second->first; 1251 const String16& localId = breakpointIterator->second.first;
1249 hitBreakpointIds->addItem(localId); 1252 hitBreakpointIds->addItem(localId);
1250 1253
1251 BreakpointSource source = breakpointIterator->second->second; 1254 BreakpointSource source = breakpointIterator->second.second;
1252 if (m_breakReason == protocol::Debugger::Paused::ReasonEnum::Other & & source == DebugCommandBreakpointSource) 1255 if (m_breakReason == protocol::Debugger::Paused::ReasonEnum::Other & & source == DebugCommandBreakpointSource)
1253 m_breakReason = protocol::Debugger::Paused::ReasonEnum::DebugCom mand; 1256 m_breakReason = protocol::Debugger::Paused::ReasonEnum::DebugCom mand;
1254 } 1257 }
1255 } 1258 }
1256 1259
1257 ErrorString errorString; 1260 ErrorString errorString;
1258 m_frontend.paused(currentCallFrames(&errorString), m_breakReason, std::move( m_breakAuxData), std::move(hitBreakpointIds), currentAsyncStackTrace()); 1261 m_frontend.paused(currentCallFrames(&errorString), m_breakReason, std::move( m_breakAuxData), std::move(hitBreakpointIds), currentAsyncStackTrace());
1259 m_scheduledDebuggerStep = NoStep; 1262 m_scheduledDebuggerStep = NoStep;
1260 m_javaScriptPauseScheduled = false; 1263 m_javaScriptPauseScheduled = false;
1261 m_steppingFromFramework = false; 1264 m_steppingFromFramework = false;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 { 1332 {
1330 if (!enabled()) 1333 if (!enabled())
1331 return; 1334 return;
1332 m_scheduledDebuggerStep = NoStep; 1335 m_scheduledDebuggerStep = NoStep;
1333 m_scripts.clear(); 1336 m_scripts.clear();
1334 m_blackboxedPositions.clear(); 1337 m_blackboxedPositions.clear();
1335 m_breakpointIdToDebuggerBreakpointIds.clear(); 1338 m_breakpointIdToDebuggerBreakpointIds.clear();
1336 } 1339 }
1337 1340
1338 } // namespace blink 1341 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698