| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (location) | 696 if (location) |
| 693 m_frontend->breakpointResolved(it->key, location); | 697 m_frontend->breakpointResolved(it->key, location); |
| 694 } | 698 } |
| 695 } | 699 } |
| 696 | 700 |
| 697 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String
& data, int firstLine, int errorLine, const String& errorMessage) | 701 void InspectorDebuggerAgent::failedToParseSource(const String& url, const String
& data, int firstLine, int errorLine, const String& errorMessage) |
| 698 { | 702 { |
| 699 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag
e); | 703 m_frontend->scriptFailedToParse(url, data, firstLine, errorLine, errorMessag
e); |
| 700 } | 704 } |
| 701 | 705 |
| 702 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu
e& callFrames, const ScriptValue& exception) | 706 void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValu
e& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoint
s) |
| 703 { | 707 { |
| 704 ASSERT(scriptState && !m_pausedScriptState); | 708 ASSERT(scriptState && !m_pausedScriptState); |
| 705 m_pausedScriptState = scriptState; | 709 m_pausedScriptState = scriptState; |
| 706 m_currentCallStack = callFrames; | 710 m_currentCallStack = callFrames; |
| 707 | 711 |
| 708 if (!exception.hasNoValue()) { | 712 if (!exception.hasNoValue()) { |
| 709 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); | 713 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); |
| 710 if (!injectedScript.hasNoValue()) { | 714 if (!injectedScript.hasNoValue()) { |
| 711 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; | 715 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; |
| 712 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->
openAccessors(); | 716 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->
openAccessors(); |
| 713 // m_breakAuxData might be null after this. | 717 // m_breakAuxData might be null after this. |
| 714 } | 718 } |
| 715 } | 719 } |
| 716 | 720 |
| 717 m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData); | 721 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); |
| 722 |
| 723 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea
kpoints.end(); ++i) { |
| 724 DebugServerBreakpointIdToBreakpointIdMap::iterator breakpointIterator =
m_serverBreakpointIdToBreakpointId.find(*i); |
| 725 if (breakpointIterator != m_serverBreakpointIdToBreakpointId.end()) |
| 726 hitBreakpointIds->addItem(breakpointIterator->value); |
| 727 } |
| 728 |
| 729 m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData, hitBr
eakpointIds); |
| 718 m_javaScriptPauseScheduled = false; | 730 m_javaScriptPauseScheduled = false; |
| 719 | 731 |
| 720 if (!m_continueToLocationBreakpointId.isEmpty()) { | 732 if (!m_continueToLocationBreakpointId.isEmpty()) { |
| 721 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); | 733 scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); |
| 722 m_continueToLocationBreakpointId = ""; | 734 m_continueToLocationBreakpointId = ""; |
| 723 } | 735 } |
| 724 if (m_listener) | 736 if (m_listener) |
| 725 m_listener->didPause(); | 737 m_listener->didPause(); |
| 726 } | 738 } |
| 727 | 739 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 void InspectorDebuggerAgent::reset() | 806 void InspectorDebuggerAgent::reset() |
| 795 { | 807 { |
| 796 m_scripts.clear(); | 808 m_scripts.clear(); |
| 797 m_breakpointIdToDebugServerBreakpointIds.clear(); | 809 m_breakpointIdToDebugServerBreakpointIds.clear(); |
| 798 if (m_frontend) | 810 if (m_frontend) |
| 799 m_frontend->globalObjectCleared(); | 811 m_frontend->globalObjectCleared(); |
| 800 } | 812 } |
| 801 | 813 |
| 802 } // namespace WebCore | 814 } // namespace WebCore |
| 803 | 815 |
| OLD | NEW |