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

Side by Side Diff: src/debug/debug-interface.h

Issue 2696163002: [debugger] implement inspector-facing API for code coverage. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_DEBUG_DEBUG_INTERFACE_H_ 5 #ifndef V8_DEBUG_DEBUG_INTERFACE_H_
6 #define V8_DEBUG_DEBUG_INTERFACE_H_ 6 #define V8_DEBUG_DEBUG_INTERFACE_H_
7 7
8 #include <functional> 8 #include <functional>
9 9
10 #include "include/v8-debug.h" 10 #include "include/v8-debug.h"
11 #include "include/v8-util.h" 11 #include "include/v8-util.h"
12 #include "include/v8.h" 12 #include "include/v8.h"
13 13
14 #include "src/debug/interface-types.h" 14 #include "src/debug/interface-types.h"
15 #include "src/globals.h"
15 16
16 namespace v8 { 17 namespace v8 {
18
19 namespace internal {
20 struct CoverageRange;
21 class Coverage;
22 class Script;
23 }
24
17 namespace debug { 25 namespace debug {
18 26
19 /** 27 /**
20 * Debugger is running in its own context which is entered while debugger 28 * Debugger is running in its own context which is entered while debugger
21 * messages are being dispatched. This is an explicit getter for this 29 * messages are being dispatched. This is an explicit getter for this
22 * debugger context. Note that the content of the debugger context is subject 30 * debugger context. Note that the content of the debugger context is subject
23 * to change. The Context exists only when the debugger is active, i.e. at 31 * to change. The Context exists only when the debugger is active, i.e. at
24 * least one DebugEventListener or MessageHandler is set. 32 * least one DebugEventListener or MessageHandler is set.
25 */ 33 */
26 Local<Context> GetDebugContext(Isolate* isolate); 34 Local<Context> GetDebugContext(Isolate* isolate);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 class GeneratorObject { 199 class GeneratorObject {
192 public: 200 public:
193 v8::MaybeLocal<debug::Script> Script(); 201 v8::MaybeLocal<debug::Script> Script();
194 v8::Local<v8::Function> Function(); 202 v8::Local<v8::Function> Function();
195 debug::Location SuspendedLocation(); 203 debug::Location SuspendedLocation();
196 bool IsSuspended(); 204 bool IsSuspended();
197 205
198 static v8::Local<debug::GeneratorObject> Cast(v8::Local<v8::Value> value); 206 static v8::Local<debug::GeneratorObject> Cast(v8::Local<v8::Value> value);
199 }; 207 };
200 208
209 /*
210 * Provide API layer between inspector and code coverage.
211 */
212 class Coverage {
213 public:
214 class Range {
215 public:
216 // 0-based line and colum numbers.
217 Location Start() { return start_; }
218 Location End() { return end_; }
219 uint32_t Count();
220 size_t NestedCount();
221 Range GetNested(size_t i);
222 MaybeLocal<String> Name();
223
224 private:
225 Range(i::CoverageRange* range, Local<debug::Script> script);
226 i::CoverageRange* range_;
227 Location start_;
228 Location end_;
229 Local<debug::Script> script_;
230
231 friend class debug::Coverage;
232 };
233
234 V8_EXPORT_PRIVATE static Coverage Collect(Isolate* isolate);
235
236 V8_EXPORT_PRIVATE static void TogglePrecise(Isolate* isolate, bool enable);
237
238 size_t ScriptCount();
239 Local<debug::Script> GetScript(size_t i);
240 Range GetRange(size_t i);
241
242 ~Coverage();
243
244 private:
245 explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {}
246 i::Coverage* coverage_;
247 };
201 } // namespace debug 248 } // namespace debug
202 } // namespace v8 249 } // namespace v8
203 250
204 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ 251 #endif // V8_DEBUG_DEBUG_INTERFACE_H_
OLDNEW
« src/debug/debug-coverage.cc ('K') | « src/debug/debug-coverage.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698