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

Unified Diff: runtime/vm/object.cc

Issue 346003003: vmservice: Add /coverage collection to scripts, classes and libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: exclude service_classescoverage from simmips tests Created 6 years, 6 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: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 0236cf1ad81de4925f30ac7712b3a716ccfaa955..604e9e5f69794cc740dd67716754ea333c51a63c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8307,6 +8307,54 @@ void Script::PrintJSONImpl(JSONStream* stream, bool ref) const {
}
+RawLibrary* Script::FindLibrary() const {
+ Isolate* isolate = Isolate::Current();
+ const GrowableObjectArray& libs = GrowableObjectArray::Handle(
+ isolate, isolate->object_store()->libraries());
+ Library& lib = Library::Handle();
+ Script& script = Script::Handle();
+ for (intptr_t i = 0; i < libs.Length(); i++) {
+ lib ^= libs.At(i);
+ ASSERT(!lib.IsNull());
+ const Array& loaded_scripts = Array::Handle(lib.LoadedScripts());
+ ASSERT(!loaded_scripts.IsNull());
+ for (intptr_t j = 0; j < loaded_scripts.Length(); j++) {
+ script ^= loaded_scripts.At(j);
+ ASSERT(!script.IsNull());
+ if (script.raw() == raw()) {
+ return lib.raw();
Ivan Posva 2014/06/26 10:14:33 How does this work for scripts that have been incl
+ }
+ }
+ }
+ return Library::null();
+}
+
+
+RawScript* Script::FindByUrl(const String& url) {
+ Isolate* isolate = Isolate::Current();
+ const GrowableObjectArray& libs = GrowableObjectArray::Handle(
+ isolate, isolate->object_store()->libraries());
+ Library& lib = Library::Handle();
+ Script& script = Script::Handle();
+ String& script_url = String::Handle();
+ for (intptr_t i = 0; i < libs.Length(); i++) {
+ lib ^= libs.At(i);
+ ASSERT(!lib.IsNull());
+ const Array& loaded_scripts = Array::Handle(lib.LoadedScripts());
+ ASSERT(!loaded_scripts.IsNull());
+ for (intptr_t j = 0; j < loaded_scripts.Length(); j++) {
+ script ^= loaded_scripts.At(j);
+ ASSERT(!script.IsNull());
+ script_url ^= script.url();
+ if (script_url.Equals(url)) {
+ return script.raw();
+ }
+ }
+ }
+ return Script::null();
+}
+
+
DictionaryIterator::DictionaryIterator(const Library& library)
: array_(Array::Handle(library.dictionary())),
// Last element in array is a Smi indicating the number of entries used.
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | runtime/vm/service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698