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

Unified Diff: src/debug/debug-interface.h

Issue 2696163002: [debugger] implement inspector-facing API for code coverage. (Closed)
Patch Set: one more shared export 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/debug-coverage.cc ('k') | src/debug/interface-types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug-interface.h
diff --git a/src/debug/debug-interface.h b/src/debug/debug-interface.h
index f76f4020fb3ca9c0d1b9000c289dde8b871b47dc..ea89ce59f1ca8f3810136f8dd019fc6931253f74 100644
--- a/src/debug/debug-interface.h
+++ b/src/debug/debug-interface.h
@@ -12,8 +12,16 @@
#include "include/v8.h"
#include "src/debug/interface-types.h"
+#include "src/globals.h"
namespace v8 {
+
+namespace internal {
+struct CoverageRange;
+class Coverage;
+class Script;
+}
+
namespace debug {
/**
@@ -109,7 +117,7 @@ void SetOutOfMemoryCallback(Isolate* isolate, OutOfMemoryCallback callback,
/**
* Native wrapper around v8::internal::Script object.
*/
-class Script {
+class V8_EXPORT_PRIVATE Script {
public:
v8::Isolate* GetIsolate() const;
@@ -198,6 +206,45 @@ class GeneratorObject {
static v8::Local<debug::GeneratorObject> Cast(v8::Local<v8::Value> value);
};
+/*
+ * Provide API layer between inspector and code coverage.
+ */
+class V8_EXPORT_PRIVATE Coverage {
+ public:
+ class V8_EXPORT_PRIVATE Range {
+ public:
+ // 0-based line and colum numbers.
+ Location Start() { return start_; }
+ Location End() { return end_; }
+ uint32_t Count();
+ size_t NestedCount();
+ Range GetNested(size_t i);
+ MaybeLocal<String> Name();
+
+ private:
+ Range(i::CoverageRange* range, Local<debug::Script> script);
+ i::CoverageRange* range_;
+ Location start_;
+ Location end_;
+ Local<debug::Script> script_;
+
+ friend class debug::Coverage;
+ };
+
+ static Coverage Collect(Isolate* isolate);
+
+ static void TogglePrecise(Isolate* isolate, bool enable);
+
+ size_t ScriptCount();
+ Local<debug::Script> GetScript(size_t i);
+ Range GetRange(size_t i);
+
+ ~Coverage();
+
+ private:
+ explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {}
+ i::Coverage* coverage_;
+};
} // namespace debug
} // namespace v8
« no previous file with comments | « src/debug/debug-coverage.cc ('k') | src/debug/interface-types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698