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

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

Issue 2668613002: [inspector] added Debugger.moduleRequested notification
Patch Set: added missing test 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
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!script->WasCompiled()) continue; 119 if (!script->WasCompiled()) continue;
120 v8::Local<v8::Value> contextData; 120 v8::Local<v8::Value> contextData;
121 if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32()) 121 if (!script->ContextData().ToLocal(&contextData) || !contextData->IsInt32())
122 continue; 122 continue;
123 int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value()); 123 int contextId = static_cast<int>(contextData.As<v8::Int32>()->Value());
124 if (m_inspector->contextGroupId(contextId) != contextGroupId) continue; 124 if (m_inspector->contextGroupId(contextId) != contextGroupId) continue;
125 result.push_back(V8DebuggerScript::Create(m_isolate, script, false)); 125 result.push_back(V8DebuggerScript::Create(m_isolate, script, false));
126 } 126 }
127 } 127 }
128 128
129 void V8Debugger::reportRequestedModules() {
130 v8::debug::ReportRequestedModules(m_isolate);
131 }
132
129 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint, 133 String16 V8Debugger::setBreakpoint(const ScriptBreakpoint& breakpoint,
130 int* actualLineNumber, 134 int* actualLineNumber,
131 int* actualColumnNumber) { 135 int* actualColumnNumber) {
132 v8::HandleScope scope(m_isolate); 136 v8::HandleScope scope(m_isolate);
133 v8::Local<v8::Context> context = debuggerContext(); 137 v8::Local<v8::Context> context = debuggerContext();
134 v8::Context::Scope contextScope(context); 138 v8::Context::Scope contextScope(context);
135 139
136 v8::Local<v8::Object> info = v8::Object::New(m_isolate); 140 v8::Local<v8::Object> info = v8::Object::New(m_isolate);
137 bool success = false; 141 bool success = false;
138 success = info->Set(context, toV8StringInternalized(m_isolate, "sourceID"), 142 success = info->Set(context, toV8StringInternalized(m_isolate, "sourceID"),
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 563
560 bool V8Debugger::IsFunctionBlackboxed(v8::Local<v8::debug::Script> script, 564 bool V8Debugger::IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
561 const v8::debug::Location& start, 565 const v8::debug::Location& start,
562 const v8::debug::Location& end) { 566 const v8::debug::Location& end) {
563 V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script); 567 V8DebuggerAgentImpl* agent = agentForScript(m_inspector, script);
564 if (!agent) return false; 568 if (!agent) return false;
565 return agent->isFunctionBlackboxed(String16::fromInteger(script->Id()), start, 569 return agent->isFunctionBlackboxed(String16::fromInteger(script->Id()), start,
566 end); 570 end);
567 } 571 }
568 572
573 void V8Debugger::ModuleRequested(v8::Local<v8::debug::Script> referer,
574 v8::Local<v8::debug::Script> requested,
575 v8::Local<v8::String> specifier) {
576 V8DebuggerAgentImpl* refererAgent = agentForScript(m_inspector, referer);
577 V8DebuggerAgentImpl* requestedAgent = agentForScript(m_inspector, requested);
578 if (refererAgent != requestedAgent) return;
579 refererAgent->moduleRequested(String16::fromInteger(referer->Id()),
580 String16::fromInteger(requested->Id()),
581 toProtocolString(specifier));
582 }
583
569 void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type, 584 void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
570 int id, int parentId) { 585 int id, int parentId) {
571 if (!m_maxAsyncCallStackDepth) return; 586 if (!m_maxAsyncCallStackDepth) return;
572 // Async task events from Promises are given misaligned pointers to prevent 587 // Async task events from Promises are given misaligned pointers to prevent
573 // from overlapping with other Blink task identifiers. There is a single 588 // from overlapping with other Blink task identifiers. There is a single
574 // namespace of such ids, managed by src/js/promise.js. 589 // namespace of such ids, managed by src/js/promise.js.
575 void* ptr = reinterpret_cast<void*>(id * 2 + 1); 590 void* ptr = reinterpret_cast<void*>(id * 2 + 1);
576 switch (type) { 591 switch (type) {
577 case v8::debug::kDebugPromiseCreated: 592 case v8::debug::kDebugPromiseCreated:
578 asyncTaskCreated( 593 asyncTaskCreated(
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 1010
996 size_t stackSize = 1011 size_t stackSize =
997 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; 1012 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1;
998 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) 1013 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId))
999 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; 1014 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture;
1000 1015
1001 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); 1016 return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
1002 } 1017 }
1003 1018
1004 } // namespace v8_inspector 1019 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-debugger-agent-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698