OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/inspector/v8-debugger-agent-impl.h" | 5 #include "src/inspector/v8-debugger-agent-impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/debug/debug-interface.h" | 9 #include "src/debug/debug-interface.h" |
10 #include "src/inspector/injected-script.h" | 10 #include "src/inspector/injected-script.h" |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 m_frontend.resumed(); | 1231 m_frontend.resumed(); |
1232 } | 1232 } |
1233 | 1233 |
1234 void V8DebuggerAgentImpl::breakProgram( | 1234 void V8DebuggerAgentImpl::breakProgram( |
1235 const String16& breakReason, | 1235 const String16& breakReason, |
1236 std::unique_ptr<protocol::DictionaryValue> data) { | 1236 std::unique_ptr<protocol::DictionaryValue> data) { |
1237 if (!enabled() || !m_debugger->canBreakProgram() || m_skipAllPauses) return; | 1237 if (!enabled() || !m_debugger->canBreakProgram() || m_skipAllPauses) return; |
1238 std::vector<BreakReason> currentScheduledReason; | 1238 std::vector<BreakReason> currentScheduledReason; |
1239 currentScheduledReason.swap(m_breakReason); | 1239 currentScheduledReason.swap(m_breakReason); |
1240 pushBreakDetails(breakReason, std::move(data)); | 1240 pushBreakDetails(breakReason, std::move(data)); |
1241 if (!m_debugger->breakProgram(m_session->contextGroupId())) return; | 1241 |
| 1242 int contextGroupId = m_session->contextGroupId(); |
| 1243 int sessionId = m_session->sessionId(); |
| 1244 V8InspectorImpl* inspector = m_inspector; |
| 1245 m_debugger->breakProgram(contextGroupId); |
| 1246 // Check that session and |this| are still around. |
| 1247 if (!inspector->sessionById(contextGroupId, sessionId)) return; |
| 1248 if (!enabled()) return; |
| 1249 |
1242 popBreakDetails(); | 1250 popBreakDetails(); |
1243 m_breakReason.swap(currentScheduledReason); | 1251 m_breakReason.swap(currentScheduledReason); |
1244 if (!m_breakReason.empty()) { | 1252 if (!m_breakReason.empty()) { |
1245 m_debugger->setPauseOnNextStatement(true, m_session->contextGroupId()); | 1253 m_debugger->setPauseOnNextStatement(true, m_session->contextGroupId()); |
1246 } | 1254 } |
1247 } | 1255 } |
1248 | 1256 |
1249 void V8DebuggerAgentImpl::breakProgramOnException( | 1257 void V8DebuggerAgentImpl::breakProgramOnException( |
1250 const String16& breakReason, | 1258 const String16& breakReason, |
1251 std::unique_ptr<protocol::DictionaryValue> data) { | 1259 std::unique_ptr<protocol::DictionaryValue> data) { |
(...skipping 22 matching lines...) Expand all Loading... |
1274 | 1282 |
1275 void V8DebuggerAgentImpl::reset() { | 1283 void V8DebuggerAgentImpl::reset() { |
1276 if (!enabled()) return; | 1284 if (!enabled()) return; |
1277 m_blackboxedPositions.clear(); | 1285 m_blackboxedPositions.clear(); |
1278 resetBlackboxedStateCache(); | 1286 resetBlackboxedStateCache(); |
1279 m_scripts.clear(); | 1287 m_scripts.clear(); |
1280 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1288 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1281 } | 1289 } |
1282 | 1290 |
1283 } // namespace v8_inspector | 1291 } // namespace v8_inspector |
OLD | NEW |