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

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

Issue 2836623002: [inspector] always include user scripts in the snapshot. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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.h" 5 #include "src/inspector/v8-debugger.h"
6 6
7 #include "src/inspector/debugger-script.h" 7 #include "src/inspector/debugger-script.h"
8 #include "src/inspector/inspected-context.h" 8 #include "src/inspector/inspected-context.h"
9 #include "src/inspector/protocol/Protocol.h" 9 #include "src/inspector/protocol/Protocol.h"
10 #include "src/inspector/script-breakpoint.h" 10 #include "src/inspector/script-breakpoint.h"
(...skipping 11 matching lines...) Expand all
22 namespace { 22 namespace {
23 23
24 static const int kMaxAsyncTaskStacks = 128 * 1024; 24 static const int kMaxAsyncTaskStacks = 128 * 1024;
25 25
26 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { 26 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) {
27 return value ? v8::True(isolate) : v8::False(isolate); 27 return value ? v8::True(isolate) : v8::False(isolate);
28 } 28 }
29 29
30 V8DebuggerAgentImpl* agentForScript(V8InspectorImpl* inspector, 30 V8DebuggerAgentImpl* agentForScript(V8InspectorImpl* inspector,
31 v8::Local<v8::debug::Script> script) { 31 v8::Local<v8::debug::Script> script) {
32 v8::Local<v8::Value> contextData; 32 int contextId;
33 if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) { 33 if (!script->ContextId().To(&contextId)) return nullptr;
34 return nullptr;
35 }
36 int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value());
37 int contextGroupId = inspector->contextGroupId(contextId); 34 int contextGroupId = inspector->contextGroupId(contextId);
38 if (!contextGroupId) return nullptr; 35 if (!contextGroupId) return nullptr;
39 return inspector->enabledDebuggerAgentForGroup(contextGroupId); 36 return inspector->enabledDebuggerAgentForGroup(contextGroupId);
40 } 37 }
41 38
42 v8::MaybeLocal<v8::Array> collectionsEntries(v8::Local<v8::Context> context, 39 v8::MaybeLocal<v8::Array> collectionsEntries(v8::Local<v8::Context> context,
43 v8::Local<v8::Value> value) { 40 v8::Local<v8::Value> value) {
44 v8::Isolate* isolate = context->GetIsolate(); 41 v8::Isolate* isolate = context->GetIsolate();
45 v8::Local<v8::Array> entries; 42 v8::Local<v8::Array> entries;
46 bool isKeyValue = false; 43 bool isKeyValue = false;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 209
213 void V8Debugger::getCompiledScripts( 210 void V8Debugger::getCompiledScripts(
214 int contextGroupId, 211 int contextGroupId,
215 std::vector<std::unique_ptr<V8DebuggerScript>>& result) { 212 std::vector<std::unique_ptr<V8DebuggerScript>>& result) {
216 v8::HandleScope scope(m_isolate); 213 v8::HandleScope scope(m_isolate);
217 v8::PersistentValueVector<v8::debug::Script> scripts(m_isolate); 214 v8::PersistentValueVector<v8::debug::Script> scripts(m_isolate);
218 v8::debug::GetLoadedScripts(m_isolate, scripts); 215 v8::debug::GetLoadedScripts(m_isolate, scripts);
219 for (size_t i = 0; i < scripts.Size(); ++i) { 216 for (size_t i = 0; i < scripts.Size(); ++i) {
220 v8::Local<v8::debug::Script> script = scripts.Get(i); 217 v8::Local<v8::debug::Script> script = scripts.Get(i);
221 if (!script->WasCompiled()) continue; 218 if (!script->WasCompiled()) continue;
222 v8::Local<v8::Value> contextData; 219 if (script->IsEmbedded()) {
223 if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) 220 result.push_back(V8DebuggerScript::Create(m_isolate, script, false));
224 continue; 221 continue;
225 int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value()); 222 }
223 int contextId;
224 if (!script->ContextId().To(&contextId)) continue;
226 if (m_inspector->contextGroupId(contextId) != contextGroupId) continue; 225 if (m_inspector->contextGroupId(contextId) != contextGroupId) continue;
227 result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); 226 result.push_back(V8DebuggerScript::Create(m_isolate, script, false));
228 } 227 }
229 } 228 }
230 229
231 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, 230 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint,
232 int* actualLineNumber, 231 int* actualLineNumber,
233 int* actualColumnNumber) { 232 int* actualColumnNumber) {
234 v8::HandleScope scope(m_isolate); 233 v8::HandleScope scope(m_isolate);
235 v8::Local<v8::Context> context = debuggerContext(); 234 v8::Local<v8::Context> context = debuggerContext();
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 fprintf(stdout, "Async stacks count: %d\n", m_asyncStacksCount); 1076 fprintf(stdout, "Async stacks count: %d\n", m_asyncStacksCount);
1078 fprintf(stdout, "Scheduled async tasks: %zu\n", m_asyncTaskStacks.size()); 1077 fprintf(stdout, "Scheduled async tasks: %zu\n", m_asyncTaskStacks.size());
1079 fprintf(stdout, "Created async tasks: %zu\n", 1078 fprintf(stdout, "Created async tasks: %zu\n",
1080 m_asyncTaskCreationStacks.size()); 1079 m_asyncTaskCreationStacks.size());
1081 fprintf(stdout, "Async tasks with parent: %zu\n", m_parentTask.size()); 1080 fprintf(stdout, "Async tasks with parent: %zu\n", m_parentTask.size());
1082 fprintf(stdout, "Recurring async tasks: %zu\n", m_recurringTasks.size()); 1081 fprintf(stdout, "Recurring async tasks: %zu\n", m_recurringTasks.size());
1083 fprintf(stdout, "\n"); 1082 fprintf(stdout, "\n");
1084 } 1083 }
1085 1084
1086 } // namespace v8_inspector 1085 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/inspector/v8-debugger-script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698