Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: src/inspector/v8-debugger-agent-impl.cc

Issue 2668613002: [inspector] added Debugger.moduleRequested notification
Patch Set: addressed comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // m_inspector->addListener may result in reporting all parsed scripts to 145 // m_inspector->addListener may result in reporting all parsed scripts to
146 // the agent so it should already be in enabled state by then. 146 // the agent so it should already be in enabled state by then.
147 m_enabled = true; 147 m_enabled = true;
148 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); 148 m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true);
149 m_debugger->enable(); 149 m_debugger->enable();
150 150
151 std::vector<std::unique_ptr<V8DebuggerScript>> compiledScripts; 151 std::vector<std::unique_ptr<V8DebuggerScript>> compiledScripts;
152 m_debugger->getCompiledScripts(m_session->contextGroupId(), compiledScripts); 152 m_debugger->getCompiledScripts(m_session->contextGroupId(), compiledScripts);
153 for (size_t i = 0; i < compiledScripts.size(); i++) 153 for (size_t i = 0; i < compiledScripts.size(); i++)
154 didParseSource(std::move(compiledScripts[i]), true); 154 didParseSource(std::move(compiledScripts[i]), true);
155 m_debugger->reportExistingModules();
155 156
156 // FIXME(WK44513): breakpoints activated flag should be synchronized between 157 // FIXME(WK44513): breakpoints activated flag should be synchronized between
157 // all front-ends 158 // all front-ends
158 m_debugger->setBreakpointsActivated(true); 159 m_debugger->setBreakpointsActivated(true);
159 } 160 }
160 161
161 bool V8DebuggerAgentImpl::enabled() { return m_enabled; } 162 bool V8DebuggerAgentImpl::enabled() { return m_enabled; }
162 163
163 Response V8DebuggerAgentImpl::enable() { 164 Response V8DebuggerAgentImpl::enable() {
164 if (enabled()) return Response::OK(); 165 if (enabled()) return Response::OK();
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 &breakpoint.column_number); 1053 &breakpoint.column_number);
1053 breakpointObject->getString(DebuggerAgentState::condition, 1054 breakpointObject->getString(DebuggerAgentState::condition,
1054 &breakpoint.condition); 1055 &breakpoint.condition);
1055 std::unique_ptr<protocol::Debugger::Location> location = 1056 std::unique_ptr<protocol::Debugger::Location> location =
1056 resolveBreakpoint(cookie.first, breakpoint, UserBreakpointSource); 1057 resolveBreakpoint(cookie.first, breakpoint, UserBreakpointSource);
1057 if (location) 1058 if (location)
1058 m_frontend.breakpointResolved(cookie.first, std::move(location)); 1059 m_frontend.breakpointResolved(cookie.first, std::move(location));
1059 } 1060 }
1060 } 1061 }
1061 1062
1063 void V8DebuggerAgentImpl::moduleResolved(const String16& refererId,
1064 const String16& requestedId,
1065 const String16& specifier) {
1066 if (m_scripts.find(refererId) == m_scripts.end()) return;
1067 if (m_scripts.find(requestedId) == m_scripts.end()) return;
1068 m_frontend.moduleResolved(refererId, requestedId, specifier);
1069 }
1070
1062 bool V8DebuggerAgentImpl::didPause(v8::Local<v8::Context> context, 1071 bool V8DebuggerAgentImpl::didPause(v8::Local<v8::Context> context,
1063 v8::Local<v8::Value> exception, 1072 v8::Local<v8::Value> exception,
1064 const std::vector<String16>& hitBreakpoints, 1073 const std::vector<String16>& hitBreakpoints,
1065 bool isPromiseRejection, bool isUncaught, 1074 bool isPromiseRejection, bool isUncaught,
1066 bool isOOMBreak) { 1075 bool isOOMBreak) {
1067 if (!isOOMBreak) { 1076 if (!isOOMBreak) {
1068 if (m_skipAllPauses) return false; 1077 if (m_skipAllPauses) return false;
1069 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); 1078 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1);
1070 JavaScriptCallFrame* topCallFrame = 1079 JavaScriptCallFrame* topCallFrame =
1071 !callFrames.empty() ? callFrames.begin()->get() : nullptr; 1080 !callFrames.empty() ? callFrames.begin()->get() : nullptr;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 void V8DebuggerAgentImpl::reset() { 1198 void V8DebuggerAgentImpl::reset() {
1190 if (!enabled()) return; 1199 if (!enabled()) return;
1191 m_scheduledDebuggerStep = NoStep; 1200 m_scheduledDebuggerStep = NoStep;
1192 m_blackboxedPositions.clear(); 1201 m_blackboxedPositions.clear();
1193 resetBlackboxedStateCache(); 1202 resetBlackboxedStateCache();
1194 m_scripts.clear(); 1203 m_scripts.clear();
1195 m_breakpointIdToDebuggerBreakpointIds.clear(); 1204 m_breakpointIdToDebuggerBreakpointIds.clear();
1196 } 1205 }
1197 1206
1198 } // namespace v8_inspector 1207 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698