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

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

Issue 15096004: Passing hit breakpoint IDs to ScriptDebugServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 3 * Copyright (C) 2010-2011 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakp ointId) 289 void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakp ointId)
290 { 290 {
291 RefPtr<InspectorObject> breakpointsCookie = m_state->getObject(DebuggerAgent State::javaScriptBreakpoints); 291 RefPtr<InspectorObject> breakpointsCookie = m_state->getObject(DebuggerAgent State::javaScriptBreakpoints);
292 breakpointsCookie->remove(breakpointId); 292 breakpointsCookie->remove(breakpointId);
293 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie); 293 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo kie);
294 294
295 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); 295 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId);
296 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin tIds.end()) 296 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin tIds.end())
297 return; 297 return;
298 for (size_t i = 0; i < debugServerBreakpointIdsIterator->value.size(); ++i) 298 for (size_t i = 0; i < debugServerBreakpointIdsIterator->value.size(); ++i) {
299 scriptDebugServer().removeBreakpoint(debugServerBreakpointIdsIterator->v alue[i]); 299 scriptDebugServer().removeBreakpoint(debugServerBreakpointIdsIterator->v alue[i]);
300 m_serverBreakpointIdToBreakpointId.remove(debugServerBreakpointIdsIterat or->value[i]);
301 }
300 m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIter ator); 302 m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIter ator);
301 } 303 }
302 304
303 void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<InspectorObject>& location) 305 void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<InspectorObject>& location)
304 { 306 {
305 if (!m_continueToLocationBreakpointId.isEmpty()) { 307 if (!m_continueToLocationBreakpointId.isEmpty()) {
306 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); 308 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
307 m_continueToLocationBreakpointId = ""; 309 m_continueToLocationBreakpointId = "";
308 } 310 }
309 311
(...skipping 17 matching lines...) Expand all
327 Script& script = scriptIterator->value; 329 Script& script = scriptIterator->value;
328 if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint. lineNumber) 330 if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint. lineNumber)
329 return 0; 331 return 0;
330 332
331 int actualLineNumber; 333 int actualLineNumber;
332 int actualColumnNumber; 334 int actualColumnNumber;
333 String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber); 335 String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber);
334 if (debugServerBreakpointId.isEmpty()) 336 if (debugServerBreakpointId.isEmpty())
335 return 0; 337 return 0;
336 338
339 m_serverBreakpointIdToBreakpointId.set(debugServerBreakpointId, breakpointId );
340
337 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); 341 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId);
338 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin tIds.end()) 342 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin tIds.end())
339 debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpoint Ids.set(breakpointId, Vector<String>()).iterator; 343 debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpoint Ids.set(breakpointId, Vector<String>()).iterator;
340 debugServerBreakpointIdsIterator->value.append(debugServerBreakpointId); 344 debugServerBreakpointIdsIterator->value.append(debugServerBreakpointId);
341 345
342 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create() 346 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create()
343 .setScriptId(scriptId) 347 .setScriptId(scriptId)
344 .setLineNumber(actualLineNumber); 348 .setLineNumber(actualLineNumber);
345 location->setColumnNumber(actualColumnNumber); 349 location->setColumnNumber(actualColumnNumber);
346 return location; 350 return location;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 if (location) 698 if (location)
695 m_frontend->breakpointResolved(it->key, location); 699 m_frontend->breakpointResolved(it->key, location);
696 } 700 }
697 } 701 }
698 702
699 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String & data, int firstLine, int errorLine, const String& errorMessage) 703 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String & data, int firstLine, int errorLine, const String& errorMessage)
700 { 704 {
701 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag e); 705 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag e);
702 } 706 }
703 707
704 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu e& callFrames, const ScriptValue& exception) 708 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu e& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoint s)
705 { 709 {
706 ASSERT(scriptState && !m_pausedScriptState); 710 ASSERT(scriptState && !m_pausedScriptState);
707 m_pausedScriptState = scriptState; 711 m_pausedScriptState = scriptState;
708 m_currentCallStack = callFrames; 712 m_currentCallStack = callFrames;
709 713
710 if (!exception.hasNoValue()) { 714 if (!exception.hasNoValue()) {
711 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState); 715 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState);
712 if (!injectedScript.hasNoValue()) { 716 if (!injectedScript.hasNoValue()) {
713 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; 717 m_breakReason = InspectorFrontend::Debugger::Reason::Exception;
714 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")-> openAccessors(); 718 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")-> openAccessors();
715 // m_breakAuxData might be null after this. 719 // m_breakAuxData might be null after this.
716 } 720 }
717 } 721 }
718 722
719 m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData); 723 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create();
724
725 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea kpoints.end(); ++i) {
726 DebugServerBreakpointIdToBreakpointIdMap::iterator breakpointIterator = m_serverBreakpointIdToBreakpointId.find(*i);
727 if (breakpointIterator != m_serverBreakpointIdToBreakpointId.end())
728 hitBreakpointIds->addItem(breakpointIterator->value);
729 }
730
731 m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData, hitBr eakpointIds);
720 m_javaScriptPauseScheduled = false; 732 m_javaScriptPauseScheduled = false;
721 733
722 if (!m_continueToLocationBreakpointId.isEmpty()) { 734 if (!m_continueToLocationBreakpointId.isEmpty()) {
723 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); 735 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
724 m_continueToLocationBreakpointId = ""; 736 m_continueToLocationBreakpointId = "";
725 } 737 }
726 if (m_listener) 738 if (m_listener)
727 m_listener->didPause(); 739 m_listener->didPause();
728 } 740 }
729 741
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 void InspectorDebuggerAgent::reset() 808 void InspectorDebuggerAgent::reset()
797 { 809 {
798 m_scripts.clear(); 810 m_scripts.clear();
799 m_breakpointIdToDebugServerBreakpointIds.clear(); 811 m_breakpointIdToDebugServerBreakpointIds.clear();
800 if (m_frontend) 812 if (m_frontend)
801 m_frontend->globalObjectCleared(); 813 m_frontend->globalObjectCleared();
802 } 814 }
803 815
804 } // namespace WebCore 816 } // namespace WebCore
805 817
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698