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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 namespace WebCore { | 54 namespace WebCore { |
55 | 55 |
56 namespace DebuggerAgentState { | 56 namespace DebuggerAgentState { |
57 static const char debuggerEnabled[] = "debuggerEnabled"; | 57 static const char debuggerEnabled[] = "debuggerEnabled"; |
58 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; | 58 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; |
59 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; | 59 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; |
60 }; | 60 }; |
61 | 61 |
62 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace"; | 62 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace"; |
63 | 63 |
| 64 static String generateBreakpointId(const String& scriptId, int lineNumber, int c
olumnNumber) |
| 65 { |
| 66 return scriptId + ':' + String::number(lineNumber) + ':' + String::number(co
lumnNumber); |
| 67 } |
| 68 |
64 InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentin
gAgents, InspectorCompositeState* inspectorState, InjectedScriptManager* injecte
dScriptManager) | 69 InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentin
gAgents, InspectorCompositeState* inspectorState, InjectedScriptManager* injecte
dScriptManager) |
65 : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger", instrumentingAgents
, inspectorState) | 70 : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger", instrumentingAgents
, inspectorState) |
66 , m_injectedScriptManager(injectedScriptManager) | 71 , m_injectedScriptManager(injectedScriptManager) |
67 , m_frontend(0) | 72 , m_frontend(0) |
68 , m_pausedScriptState(0) | 73 , m_pausedScriptState(0) |
69 , m_javaScriptPauseScheduled(false) | 74 , m_javaScriptPauseScheduled(false) |
70 , m_listener(0) | 75 , m_listener(0) |
71 { | 76 { |
72 // FIXME: make breakReason optional so that there was no need to init it wit
h "other". | 77 // FIXME: make breakReason optional so that there was no need to init it wit
h "other". |
73 clearBreakDetails(); | 78 clearBreakDetails(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 { | 258 { |
254 String scriptId; | 259 String scriptId; |
255 int lineNumber; | 260 int lineNumber; |
256 int columnNumber; | 261 int columnNumber; |
257 | 262 |
258 if (!parseLocation(errorString, location, &scriptId, &lineNumber, &columnNum
ber)) | 263 if (!parseLocation(errorString, location, &scriptId, &lineNumber, &columnNum
ber)) |
259 return; | 264 return; |
260 | 265 |
261 String condition = optionalCondition ? *optionalCondition : emptyString(); | 266 String condition = optionalCondition ? *optionalCondition : emptyString(); |
262 | 267 |
263 String breakpointId = scriptId + ':' + String::number(lineNumber) + ':' + St
ring::number(columnNumber); | 268 String breakpointId = generateBreakpointId(scriptId, lineNumber, columnNumbe
r); |
264 if (m_breakpointIdToDebugServerBreakpointIds.find(breakpointId) != m_breakpo
intIdToDebugServerBreakpointIds.end()) { | 269 if (m_breakpointIdToDebugServerBreakpointIds.find(breakpointId) != m_breakpo
intIdToDebugServerBreakpointIds.end()) { |
265 *errorString = "Breakpoint at specified location already exists."; | 270 *errorString = "Breakpoint at specified location already exists."; |
266 return; | 271 return; |
267 } | 272 } |
268 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); | 273 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); |
269 actualLocation = resolveBreakpoint(breakpointId, scriptId, breakpoint); | 274 actualLocation = resolveBreakpoint(breakpointId, scriptId, breakpoint); |
270 if (actualLocation) | 275 if (actualLocation) |
271 *outBreakpointId = breakpointId; | 276 *outBreakpointId = breakpointId; |
272 else | 277 else |
273 *errorString = "Could not resolve breakpoint"; | 278 *errorString = "Could not resolve breakpoint"; |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 } | 766 } |
762 | 767 |
763 void ScriptDebugListener::Script::reportMemoryUsage(MemoryObjectInfo* memoryObje
ctInfo) const | 768 void ScriptDebugListener::Script::reportMemoryUsage(MemoryObjectInfo* memoryObje
ctInfo) const |
764 { | 769 { |
765 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDe
buggerAgent); | 770 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDe
buggerAgent); |
766 info.addMember(url, "url"); | 771 info.addMember(url, "url"); |
767 info.addMember(source, "source"); | 772 info.addMember(source, "source"); |
768 info.addMember(sourceMappingURL, "sourceMappingURL"); | 773 info.addMember(sourceMappingURL, "sourceMappingURL"); |
769 } | 774 } |
770 | 775 |
| 776 void InspectorDebuggerAgent::setBreakpoint(const String& scriptId, int lineNumbe
r, int columnNumber) |
| 777 { |
| 778 String breakpointId = generateBreakpointId(scriptId, lineNumber, columnNumbe
r); |
| 779 ScriptBreakpoint breakpoint(lineNumber, columnNumber, emptyString()); |
| 780 resolveBreakpoint(breakpointId, scriptId, breakpoint); |
| 781 } |
| 782 |
| 783 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber) |
| 784 { |
| 785 String breakpointId = generateBreakpointId(scriptId, lineNumber, columnNumbe
r); |
| 786 ErrorString errorString; |
| 787 removeBreakpoint(&errorString, breakpointId); |
| 788 } |
| 789 |
771 void InspectorDebuggerAgent::reset() | 790 void InspectorDebuggerAgent::reset() |
772 { | 791 { |
773 m_scripts.clear(); | 792 m_scripts.clear(); |
774 m_breakpointIdToDebugServerBreakpointIds.clear(); | 793 m_breakpointIdToDebugServerBreakpointIds.clear(); |
775 if (m_frontend) | 794 if (m_frontend) |
776 m_frontend->globalObjectCleared(); | 795 m_frontend->globalObjectCleared(); |
777 } | 796 } |
778 | 797 |
779 } // namespace WebCore | 798 } // namespace WebCore |
780 | 799 |
OLD | NEW |