OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_COVERAGE_H_ | 5 #ifndef VM_COVERAGE_H_ |
6 #define VM_COVERAGE_H_ | 6 #define VM_COVERAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 DECLARE_FLAG(charp, coverage_dir); | 13 DECLARE_FLAG(charp, coverage_dir); |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class Class; | 16 class Class; |
17 class Function; | 17 class Function; |
18 template <typename T> class GrowableArray; | 18 template <typename T> class GrowableArray; |
19 class Isolate; | 19 class Isolate; |
20 class JSONArray; | 20 class JSONArray; |
21 class JSONStream; | 21 class JSONStream; |
22 class Library; | 22 class Library; |
23 class Script; | 23 class Script; |
24 class String; | 24 class String; |
25 | 25 |
26 class CoverageFilter : public ValueObject { | 26 class CoverageFilter : public ValueObject { |
27 public: | 27 public: |
28 virtual bool ShouldOutputCoverageFor(const Library& lib, | 28 virtual bool ShouldOutputCoverageFor(const Library& lib, |
29 const String& script_url, | 29 const Script& script, |
30 const Class& cls, | 30 const Class& cls, |
31 const Function& func) const = 0; | 31 const Function& func) const = 0; |
32 virtual ~CoverageFilter() {} | 32 virtual ~CoverageFilter() {} |
33 }; | 33 }; |
34 | 34 |
35 class CodeCoverage : public AllStatic { | 35 class CodeCoverage : public AllStatic { |
36 public: | 36 public: |
37 static void Write(Isolate* isolate); | 37 static void Write(Isolate* isolate); |
38 static void PrintJSON(Isolate* isolate, | 38 static void PrintJSON(Isolate* isolate, |
39 JSONStream* stream, | 39 JSONStream* stream, |
40 CoverageFilter* filter); | 40 CoverageFilter* filter); |
41 | 41 |
42 private: | 42 private: |
43 static void PrintClass(const Library& lib, | 43 static void PrintClass(const Library& lib, |
44 const Class& cls, | 44 const Class& cls, |
45 const JSONArray& arr, | 45 const JSONArray& arr, |
46 CoverageFilter* filter); | 46 CoverageFilter* filter); |
47 static void CompileAndAdd(const Function& function, | 47 static void CompileAndAdd(const Function& function, |
48 const JSONArray& hits_arr, | 48 const JSONArray& hits_arr, |
49 const GrowableArray<intptr_t>& pos_to_line); | 49 const GrowableArray<intptr_t>& pos_to_line); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace dart | 52 } // namespace dart |
53 | 53 |
54 #endif // VM_COVERAGE_H_ | 54 #endif // VM_COVERAGE_H_ |
OLD | NEW |