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

Unified Diff: runtime/vm/service.cc

Issue 351373002: Coverage API revamp (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« runtime/vm/coverage.cc ('K') | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 9a26f0297d1b14eb2e122b0e79581960f7e6e6e0..3ff64b46cd1d07fb074b58e7d8e347a11b714c0a 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -151,6 +151,51 @@ class EmbedderServiceHandler {
};
+class LibraryFilter : public CoverageFilter {
Michael Lippautz (Google) 2014/06/27 00:16:48 We could name those to SimpleXXXFilter and include
Cutch 2014/06/27 15:07:19 I think it's okay to leave them here with the name
Michael Lippautz (Google) 2014/06/27 17:12:24 Done.
+ public:
+ explicit LibraryFilter(const Library& lib) : lib_(lib) {}
+ ~LibraryFilter() {}
+ bool GetCoverage(const Library& lib,
+ const Script& script,
+ const Class& cls,
+ const Function& func) {
+ return lib.raw() == lib_.raw();
+ }
+ private:
+ const Library& lib_;
+};
+
+
+class ScriptFilter : public CoverageFilter {
+ public:
+ explicit ScriptFilter(const Script& script) : script_(script) {}
+ ~ScriptFilter() {}
+ bool GetCoverage(const Library& lib,
+ const Script& script,
+ const Class& cls,
+ const Function& func) {
+ return script.raw() == script_.raw();
+ }
+ private:
+ const Script& script_;
+};
+
+
+class ClassFilter : public CoverageFilter {
+ public:
+ explicit ClassFilter(const Class& cls) : cls_(cls) {}
+ ~ClassFilter() {}
+ bool GetCoverage(const Library& lib,
+ const Script& script,
+ const Class& cls,
+ const Function& func) {
+ return cls.raw() == cls_.raw();
+ }
+ private:
+ const Class& cls_;
+};
+
+
static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
return reinterpret_cast<uint8_t*>(new_ptr);
@@ -1207,7 +1252,8 @@ static bool HandleClassesInstances(Isolate* isolate, const Class& cls,
static bool HandleClassesCoverage(Isolate* isolate,
const Class& cls,
JSONStream* stream) {
- CodeCoverage::PrintJSONForClass(cls, stream);
+ ClassFilter cf(cls);
+ CodeCoverage::PrintJSON(isolate, stream, &cf);
return true;
}
@@ -1290,7 +1336,8 @@ static bool HandleLibrariesEval(Isolate* isolate, const Library& lib,
static bool HandleLibrariesCoverage(Isolate* isolate,
const Library& lib,
JSONStream* js) {
- CodeCoverage::PrintJSONForLibrary(lib, Script::Handle(), js);
+ LibraryFilter lf(lib);
+ CodeCoverage::PrintJSON(isolate, js, &lf);
return true;
}
@@ -1496,7 +1543,8 @@ static bool HandleScriptsFetch(
static bool HandleScriptsCoverage(
Isolate* isolate, const Script& script, JSONStream* js) {
- CodeCoverage::PrintJSONForScript(script, js);
+ ScriptFilter sf(script);
+ CodeCoverage::PrintJSON(isolate, js, &sf);
return true;
}
@@ -1726,7 +1774,7 @@ static bool HandleProfile(Isolate* isolate, JSONStream* js) {
}
static bool HandleCoverage(Isolate* isolate, JSONStream* js) {
- CodeCoverage::PrintJSON(isolate, js);
+ CodeCoverage::PrintJSON(isolate, js, NULL);
return true;
}
« runtime/vm/coverage.cc ('K') | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698