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

Unified Diff: src/debug/debug.cc

Issue 2668613002: [inspector] added Debugger.moduleRequested notification
Patch Set: addressed comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index adf3659c68fdf560f267037772bf9baa38efd747..b678046e038c9239b523e8d0fd828f6bc958e05f 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1894,6 +1894,39 @@ void Debug::OnAfterCompile(Handle<Script> script) {
ProcessCompileEvent(v8::AfterCompile, script);
}
+void Debug::OnModuleResolved(Handle<Module> referer, Handle<Module> requested,
+ Handle<String> specifier) {
+ if (!debug_delegate_) return;
+ if (!referer->script()->IsScript() || !requested->script()->IsScript())
+ return;
neis 2017/02/01 13:38:55 Should this ever happen? See comment in objects.h.
kozy 2017/02/01 16:39:25 Done.
+ debug_delegate_->ModuleResolved(
+ ToApiHandle<debug::Script>(handle(Script::cast(referer->script()))),
+ ToApiHandle<debug::Script>(handle(Script::cast(requested->script()))),
+ Utils::ToLocal(specifier));
+}
+
+void Debug::ReportExistingModules() {
+ if (!debug_delegate_) return;
+ HandleScope handle_scope(isolate_);
+ HeapIterator iterator(isolate_->heap());
+ HeapObject* obj;
+ while ((obj = iterator.next())) {
+ if (!obj->IsModule()) continue;
+ Handle<Module> module(Module::cast(obj));
+ if (!module->evaluated()) continue;
+ Handle<FixedArray> requested_modules(module->requested_modules(), isolate_);
+ Handle<FixedArray> module_requests(module->info()->module_requests(),
+ isolate_);
+ for (int j = 0, length = requested_modules->length(); j < length; ++j) {
+ Handle<Module> import(i::Module::cast(requested_modules->get(j)),
+ isolate_);
+ Handle<String> request(i::String::cast(module_requests->get(j)),
+ isolate_);
+ OnModuleResolved(module, import, request);
+ }
+ }
+}
+
namespace {
struct CollectedCallbackData {
Object** location;
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | src/debug/debug-interface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698