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

Unified Diff: src/api.cc

Issue 2465833002: [debugger] simplify fetching scripts for inspector. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index ad41d819b7f094ddda7834f5ca57377ae8184f03..e8aa8f188d2d50973b622d9b91cab83fe870f3fc 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -8947,12 +8947,17 @@ void DebugInterface::GetLoadedScripts(
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8(isolate);
i::HandleScope handle_scope(isolate);
- i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts();
- for (int i = 0; i < instances->length(); i++) {
- i::Handle<i::Script> script =
- i::Handle<i::Script>(i::Script::cast(instances->get(i)));
- if (script->type() != i::Script::TYPE_NORMAL) continue;
- scripts.Append(ToApiHandle<Script>(script));
+ i::Factory* factory = isolate->factory();
+ if (!factory->script_list()->IsWeakFixedArray()) return;
+ i::Handle<i::WeakFixedArray> array =
+ i::Handle<i::WeakFixedArray>::cast(factory->script_list());
+ {
+ i::Script::Iterator iterator(isolate);
+ i::Handle<i::Script> script;
+ while (!(script = i::Handle<i::Script>(iterator.Next())).is_null()) {
kozy 2016/10/31 14:59:11 I think that i::Handle<i::Script>(Object*) tries t
Yang 2016/11/02 12:25:55 Good point. I changed the code after running tests
+ if (script->type() != i::Script::TYPE_NORMAL) continue;
+ if (script->HasValidSource()) scripts.Append(ToApiHandle<Script>(script));
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698