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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 , m_pausedScriptState(nullptr) | 123 , m_pausedScriptState(nullptr) |
124 , m_javaScriptPauseScheduled(false) | 124 , m_javaScriptPauseScheduled(false) |
125 , m_debuggerStepScheduled(false) | 125 , m_debuggerStepScheduled(false) |
126 , m_steppingFromFramework(false) | 126 , m_steppingFromFramework(false) |
127 , m_pausingOnNativeEvent(false) | 127 , m_pausingOnNativeEvent(false) |
128 , m_listener(nullptr) | 128 , m_listener(nullptr) |
129 , m_skippedStepInCount(0) | 129 , m_skippedStepInCount(0) |
130 , m_skipAllPauses(false) | 130 , m_skipAllPauses(false) |
131 , m_skipContentScripts(false) | 131 , m_skipContentScripts(false) |
132 , m_asyncCallStackTracker(adoptPtrWillBeNoop(new AsyncCallStackTracker())) | 132 , m_asyncCallStackTracker(adoptPtrWillBeNoop(new AsyncCallStackTracker())) |
| 133 , m_promiseTracker(PromiseTracker::create()) |
133 { | 134 { |
134 } | 135 } |
135 | 136 |
136 InspectorDebuggerAgent::~InspectorDebuggerAgent() | 137 InspectorDebuggerAgent::~InspectorDebuggerAgent() |
137 { | 138 { |
138 #if !ENABLE(OILPAN) | 139 #if !ENABLE(OILPAN) |
139 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); | 140 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); |
140 #endif | 141 #endif |
141 } | 142 } |
142 | 143 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 String error; | 226 String error; |
226 setPauseOnExceptionsImpl(&error, pauseState); | 227 setPauseOnExceptionsImpl(&error, pauseState); |
227 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); | 228 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); |
228 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte
ntScripts); | 229 m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipConte
ntScripts); |
229 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; | 230 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; |
230 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { | 231 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { |
231 m_skipAllPauses = false; | 232 m_skipAllPauses = false; |
232 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); | 233 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); |
233 } | 234 } |
234 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); | 235 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); |
235 m_promiseTracker.setEnabled(m_state->getBoolean(DebuggerAgentState::prom
iseTrackerEnabled)); | 236 promiseTracker().setEnabled(m_state->getBoolean(DebuggerAgentState::prom
iseTrackerEnabled)); |
236 } | 237 } |
237 } | 238 } |
238 | 239 |
239 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) | 240 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
240 { | 241 { |
241 m_frontend = frontend->debugger(); | 242 m_frontend = frontend->debugger(); |
242 } | 243 } |
243 | 244 |
244 void InspectorDebuggerAgent::clearFrontend() | 245 void InspectorDebuggerAgent::clearFrontend() |
245 { | 246 { |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 else if (eventType == v8AsyncTaskEventWillHandle) | 916 else if (eventType == v8AsyncTaskEventWillHandle) |
916 asyncCallStackTracker().willHandleV8AsyncTask(context, eventName, id); | 917 asyncCallStackTracker().willHandleV8AsyncTask(context, eventName, id); |
917 else if (eventType == v8AsyncTaskEventDidHandle) | 918 else if (eventType == v8AsyncTaskEventDidHandle) |
918 asyncCallStackTracker().didFireAsyncCall(); | 919 asyncCallStackTracker().didFireAsyncCall(); |
919 else | 920 else |
920 ASSERT_NOT_REACHED(); | 921 ASSERT_NOT_REACHED(); |
921 } | 922 } |
922 | 923 |
923 void InspectorDebuggerAgent::didReceiveV8PromiseEvent(ScriptState* scriptState,
v8::Handle<v8::Object> promise, v8::Handle<v8::Value> parentPromise, int status) | 924 void InspectorDebuggerAgent::didReceiveV8PromiseEvent(ScriptState* scriptState,
v8::Handle<v8::Object> promise, v8::Handle<v8::Value> parentPromise, int status) |
924 { | 925 { |
925 if (!m_promiseTracker.isEnabled()) | 926 if (!promiseTracker().isEnabled()) |
926 return; | 927 return; |
927 m_promiseTracker.didReceiveV8PromiseEvent(scriptState, promise, parentPromis
e, status); | 928 promiseTracker().didReceiveV8PromiseEvent(scriptState, promise, parentPromis
e, status); |
928 } | 929 } |
929 | 930 |
930 void InspectorDebuggerAgent::pause(ErrorString*) | 931 void InspectorDebuggerAgent::pause(ErrorString*) |
931 { | 932 { |
932 if (m_javaScriptPauseScheduled || isPaused()) | 933 if (m_javaScriptPauseScheduled || isPaused()) |
933 return; | 934 return; |
934 clearBreakDetails(); | 935 clearBreakDetails(); |
935 m_javaScriptPauseScheduled = true; | 936 m_javaScriptPauseScheduled = true; |
936 scriptDebugServer().setPauseOnNextStatement(true); | 937 scriptDebugServer().setPauseOnNextStatement(true); |
937 } | 938 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 | 1167 |
1167 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) | 1168 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
1168 { | 1169 { |
1169 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); | 1170 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
1170 asyncCallStackTracker().setAsyncCallStackDepth(depth); | 1171 asyncCallStackTracker().setAsyncCallStackDepth(depth); |
1171 } | 1172 } |
1172 | 1173 |
1173 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*) | 1174 void InspectorDebuggerAgent::enablePromiseTracker(ErrorString*) |
1174 { | 1175 { |
1175 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true); | 1176 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, true); |
1176 m_promiseTracker.setEnabled(true); | 1177 promiseTracker().setEnabled(true); |
1177 } | 1178 } |
1178 | 1179 |
1179 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*) | 1180 void InspectorDebuggerAgent::disablePromiseTracker(ErrorString*) |
1180 { | 1181 { |
1181 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | 1182 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
1182 m_promiseTracker.setEnabled(false); | 1183 promiseTracker().setEnabled(false); |
1183 } | 1184 } |
1184 | 1185 |
1185 void InspectorDebuggerAgent::getPromises(ErrorString*, RefPtr<Array<PromiseDetai
ls> >& promises) | 1186 void InspectorDebuggerAgent::getPromises(ErrorString*, RefPtr<Array<PromiseDetai
ls> >& promises) |
1186 { | 1187 { |
1187 if (!m_promiseTracker.isEnabled()) | 1188 if (!promiseTracker().isEnabled()) |
1188 return; | 1189 return; |
1189 promises = m_promiseTracker.promises(); | 1190 promises = promiseTracker().promises(); |
1190 } | 1191 } |
1191 | 1192 |
1192 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) | 1193 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) |
1193 { | 1194 { |
1194 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { | 1195 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { |
1195 RefPtr<JSONObject> directive = JSONObject::create(); | 1196 RefPtr<JSONObject> directive = JSONObject::create(); |
1196 directive->setString("directiveText", directiveText); | 1197 directive->setString("directiveText", directiveText); |
1197 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); | 1198 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); |
1198 } | 1199 } |
1199 } | 1200 } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 scriptDebugServer().breakProgram(); | 1445 scriptDebugServer().breakProgram(); |
1445 } | 1446 } |
1446 | 1447 |
1447 void InspectorDebuggerAgent::clear() | 1448 void InspectorDebuggerAgent::clear() |
1448 { | 1449 { |
1449 m_pausedScriptState = nullptr; | 1450 m_pausedScriptState = nullptr; |
1450 m_currentCallStack = ScriptValue(); | 1451 m_currentCallStack = ScriptValue(); |
1451 m_scripts.clear(); | 1452 m_scripts.clear(); |
1452 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1453 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1453 asyncCallStackTracker().clear(); | 1454 asyncCallStackTracker().clear(); |
1454 m_promiseTracker.clear(); | 1455 promiseTracker().clear(); |
1455 m_continueToLocationBreakpointId = String(); | 1456 m_continueToLocationBreakpointId = String(); |
1456 clearBreakDetails(); | 1457 clearBreakDetails(); |
1457 m_javaScriptPauseScheduled = false; | 1458 m_javaScriptPauseScheduled = false; |
1458 m_debuggerStepScheduled = false; | 1459 m_debuggerStepScheduled = false; |
1459 m_steppingFromFramework = false; | 1460 m_steppingFromFramework = false; |
1460 m_pausingOnNativeEvent = false; | 1461 m_pausingOnNativeEvent = false; |
1461 ErrorString error; | 1462 ErrorString error; |
1462 setOverlayMessage(&error, 0); | 1463 setOverlayMessage(&error, 0); |
1463 } | 1464 } |
1464 | 1465 |
(...skipping 22 matching lines...) Expand all Loading... |
1487 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) | 1488 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) |
1488 { | 1489 { |
1489 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); | 1490 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); |
1490 } | 1491 } |
1491 | 1492 |
1492 void InspectorDebuggerAgent::reset() | 1493 void InspectorDebuggerAgent::reset() |
1493 { | 1494 { |
1494 m_scripts.clear(); | 1495 m_scripts.clear(); |
1495 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1496 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1496 asyncCallStackTracker().clear(); | 1497 asyncCallStackTracker().clear(); |
1497 m_promiseTracker.clear(); | 1498 promiseTracker().clear(); |
1498 if (m_frontend) | 1499 if (m_frontend) |
1499 m_frontend->globalObjectCleared(); | 1500 m_frontend->globalObjectCleared(); |
1500 } | 1501 } |
1501 | 1502 |
1502 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1503 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1503 { | 1504 { |
1504 visitor->trace(m_injectedScriptManager); | 1505 visitor->trace(m_injectedScriptManager); |
1505 visitor->trace(m_listener); | 1506 visitor->trace(m_listener); |
1506 visitor->trace(m_asyncCallStackTracker); | 1507 visitor->trace(m_asyncCallStackTracker); |
1507 #if ENABLE(OILPAN) | 1508 #if ENABLE(OILPAN) |
1508 visitor->trace(m_promiseTracker); | 1509 visitor->trace(m_promiseTracker); |
1509 #endif | 1510 #endif |
1510 InspectorBaseAgent::trace(visitor); | 1511 InspectorBaseAgent::trace(visitor); |
1511 } | 1512 } |
1512 | 1513 |
1513 } // namespace blink | 1514 } // namespace blink |
OLD | NEW |