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) 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 bool InspectorDebuggerAgent::runningNestedMessageLoop() | 255 bool InspectorDebuggerAgent::runningNestedMessageLoop() |
256 { | 256 { |
257 return scriptDebugServer().runningNestedMessageLoop(); | 257 return scriptDebugServer().runningNestedMessageLoop(); |
258 } | 258 } |
259 | 259 |
260 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type) | 260 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type) |
261 { | 261 { |
262 if (source == ConsoleAPIMessageSource && type == AssertMessageType && script
DebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptio
ns) | 262 if (source == ConsoleAPIMessageSource && type == AssertMessageType && script
DebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptio
ns) |
263 breakProgram(InspectorFrontend::Debugger::Reason::Assert, 0); | 263 breakProgram(InspectorFrontend::Debugger::Reason::Assert, nullptr); |
264 } | 264 } |
265 | 265 |
266 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type, MessageLevel, const String&, PassRefPtr<ScriptCallStack>, unsigned long
) | 266 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type, MessageLevel, const String&, PassRefPtr<ScriptCallStack>, unsigned long
) |
267 { | 267 { |
268 addMessageToConsole(source, type); | 268 addMessageToConsole(source, type); |
269 } | 269 } |
270 | 270 |
271 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type, MessageLevel, const String&, ScriptState*, PassRefPtr<ScriptArguments>,
unsigned long) | 271 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageTy
pe type, MessageLevel, const String&, ScriptState*, PassRefPtr<ScriptArguments>,
unsigned long) |
272 { | 272 { |
273 addMessageToConsole(source, type); | 273 addMessageToConsole(source, type); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 return ScriptDebugListener::StepOut; | 546 return ScriptDebugListener::StepOut; |
547 } | 547 } |
548 } | 548 } |
549 return ScriptDebugListener::NoSkip; | 549 return ScriptDebugListener::NoSkip; |
550 } | 550 } |
551 | 551 |
552 PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak
point(const String& breakpointId, const String& scriptId, const ScriptBreakpoint
& breakpoint, BreakpointSource source) | 552 PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak
point(const String& breakpointId, const String& scriptId, const ScriptBreakpoint
& breakpoint, BreakpointSource source) |
553 { | 553 { |
554 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); | 554 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); |
555 if (scriptIterator == m_scripts.end()) | 555 if (scriptIterator == m_scripts.end()) |
556 return 0; | 556 return nullptr; |
557 Script& script = scriptIterator->value; | 557 Script& script = scriptIterator->value; |
558 if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint.
lineNumber) | 558 if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint.
lineNumber) |
559 return 0; | 559 return nullptr; |
560 | 560 |
561 int actualLineNumber; | 561 int actualLineNumber; |
562 int actualColumnNumber; | 562 int actualColumnNumber; |
563 String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId,
breakpoint, &actualLineNumber, &actualColumnNumber, false); | 563 String debugServerBreakpointId = scriptDebugServer().setBreakpoint(scriptId,
breakpoint, &actualLineNumber, &actualColumnNumber, false); |
564 if (debugServerBreakpointId.isEmpty()) | 564 if (debugServerBreakpointId.isEmpty()) |
565 return 0; | 565 return nullptr; |
566 | 566 |
567 m_serverBreakpoints.set(debugServerBreakpointId, std::make_pair(breakpointId
, source)); | 567 m_serverBreakpoints.set(debugServerBreakpointId, std::make_pair(breakpointId
, source)); |
568 | 568 |
569 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds
Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); | 569 BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIds
Iterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); |
570 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin
tIds.end()) | 570 if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpoin
tIds.end()) |
571 m_breakpointIdToDebugServerBreakpointIds.set(breakpointId, Vector<String
>()).storedValue->value.append(debugServerBreakpointId); | 571 m_breakpointIdToDebugServerBreakpointIds.set(breakpointId, Vector<String
>()).storedValue->value.append(debugServerBreakpointId); |
572 else | 572 else |
573 debugServerBreakpointIdsIterator->value.append(debugServerBreakpointId); | 573 debugServerBreakpointIdsIterator->value.append(debugServerBreakpointId); |
574 | 574 |
575 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo
cation::create() | 575 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo
cation::create() |
576 .setScriptId(scriptId) | 576 .setScriptId(scriptId) |
577 .setLineNumber(actualLineNumber); | 577 .setLineNumber(actualLineNumber); |
578 location->setColumnNumber(actualColumnNumber); | 578 location->setColumnNumber(actualColumnNumber); |
579 return location; | 579 return location; |
580 } | 580 } |
581 | 581 |
582 static PassRefPtr<JSONObject> scriptToInspectorObject(ScriptObject scriptObject) | 582 static PassRefPtr<JSONObject> scriptToInspectorObject(ScriptObject scriptObject) |
583 { | 583 { |
584 if (scriptObject.hasNoValue()) | 584 if (scriptObject.hasNoValue()) |
585 return 0; | 585 return nullptr; |
586 RefPtr<JSONValue> value = scriptObject.toJSONValue(scriptObject.scriptState(
)); | 586 RefPtr<JSONValue> value = scriptObject.toJSONValue(scriptObject.scriptState(
)); |
587 if (!value) | 587 if (!value) |
588 return 0; | 588 return nullptr; |
589 return value->asObject(); | 589 return value->asObject(); |
590 } | 590 } |
591 | 591 |
592 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& s
criptId, const String& query, const bool* const optionalCaseSensitive, const boo
l* const optionalIsRegex, RefPtr<Array<WebCore::TypeBuilder::Page::SearchMatch>
>& results) | 592 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& s
criptId, const String& query, const bool* const optionalCaseSensitive, const boo
l* const optionalIsRegex, RefPtr<Array<WebCore::TypeBuilder::Page::SearchMatch>
>& results) |
593 { | 593 { |
594 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; | 594 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; |
595 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; | 595 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; |
596 | 596 |
597 ScriptsMap::iterator it = m_scripts.find(scriptId); | 597 ScriptsMap::iterator it = m_scripts.find(scriptId); |
598 if (it != m_scripts.end()) | 598 if (it != m_scripts.end()) |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 if (injectedScript.hasNoValue()) { | 1050 if (injectedScript.hasNoValue()) { |
1051 ASSERT_NOT_REACHED(); | 1051 ASSERT_NOT_REACHED(); |
1052 return Array<CallFrame>::create(); | 1052 return Array<CallFrame>::create(); |
1053 } | 1053 } |
1054 return injectedScript.wrapCallFrames(m_currentCallStack, 0); | 1054 return injectedScript.wrapCallFrames(m_currentCallStack, 0); |
1055 } | 1055 } |
1056 | 1056 |
1057 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() | 1057 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() |
1058 { | 1058 { |
1059 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) | 1059 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) |
1060 return 0; | 1060 return nullptr; |
1061 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); | 1061 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState); |
1062 if (injectedScript.hasNoValue()) { | 1062 if (injectedScript.hasNoValue()) { |
1063 ASSERT_NOT_REACHED(); | 1063 ASSERT_NOT_REACHED(); |
1064 return 0; | 1064 return nullptr; |
1065 } | 1065 } |
1066 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1066 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); |
1067 if (!chain) | 1067 if (!chain) |
1068 return 0; | 1068 return nullptr; |
1069 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1069 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
1070 if (callStacks.isEmpty()) | 1070 if (callStacks.isEmpty()) |
1071 return 0; | 1071 return nullptr; |
1072 RefPtr<StackTrace> result; | 1072 RefPtr<StackTrace> result; |
1073 int asyncOrdinal = callStacks.size(); | 1073 int asyncOrdinal = callStacks.size(); |
1074 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { | 1074 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { |
1075 RefPtr<StackTrace> next = StackTrace::create() | 1075 RefPtr<StackTrace> next = StackTrace::create() |
1076 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) | 1076 .setCallFrames(injectedScript.wrapCallFrames((*it)->callFrames(), as
yncOrdinal--)) |
1077 .release(); | 1077 .release(); |
1078 next->setDescription((*it)->description()); | 1078 next->setDescription((*it)->description()); |
1079 if (result) | 1079 if (result) |
1080 next->setAsyncStackTrace(result.release()); | 1080 next->setAsyncStackTrace(result.release()); |
1081 result.swap(next); | 1081 result.swap(next); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 if (!m_pausedScriptState) { | 1236 if (!m_pausedScriptState) { |
1237 *errorString = "Can only perform operation while paused."; | 1237 *errorString = "Can only perform operation while paused."; |
1238 return false; | 1238 return false; |
1239 } | 1239 } |
1240 return true; | 1240 return true; |
1241 } | 1241 } |
1242 | 1242 |
1243 void InspectorDebuggerAgent::clearBreakDetails() | 1243 void InspectorDebuggerAgent::clearBreakDetails() |
1244 { | 1244 { |
1245 m_breakReason = InspectorFrontend::Debugger::Reason::Other; | 1245 m_breakReason = InspectorFrontend::Debugger::Reason::Other; |
1246 m_breakAuxData = 0; | 1246 m_breakAuxData = nullptr; |
1247 } | 1247 } |
1248 | 1248 |
1249 void InspectorDebuggerAgent::setBreakpoint(const String& scriptId, int lineNumbe
r, int columnNumber, BreakpointSource source, const String& condition) | 1249 void InspectorDebuggerAgent::setBreakpoint(const String& scriptId, int lineNumbe
r, int columnNumber, BreakpointSource source, const String& condition) |
1250 { | 1250 { |
1251 String breakpointId = generateBreakpointId(scriptId, lineNumber, columnNumbe
r, source); | 1251 String breakpointId = generateBreakpointId(scriptId, lineNumber, columnNumbe
r, source); |
1252 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); | 1252 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); |
1253 resolveBreakpoint(breakpointId, scriptId, breakpoint, source); | 1253 resolveBreakpoint(breakpointId, scriptId, breakpoint, source); |
1254 } | 1254 } |
1255 | 1255 |
1256 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) | 1256 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) |
1257 { | 1257 { |
1258 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); | 1258 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); |
1259 } | 1259 } |
1260 | 1260 |
1261 void InspectorDebuggerAgent::reset() | 1261 void InspectorDebuggerAgent::reset() |
1262 { | 1262 { |
1263 m_scripts.clear(); | 1263 m_scripts.clear(); |
1264 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1264 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1265 m_asyncCallStackTracker.clear(); | 1265 m_asyncCallStackTracker.clear(); |
1266 if (m_frontend) | 1266 if (m_frontend) |
1267 m_frontend->globalObjectCleared(); | 1267 m_frontend->globalObjectCleared(); |
1268 } | 1268 } |
1269 | 1269 |
1270 } // namespace WebCore | 1270 } // namespace WebCore |
1271 | 1271 |
OLD | NEW |