| 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 #include "vm/coverage.h" | 5 #include "vm/coverage.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 |
| 178 void CodeCoverage::PrintToJSONStream(Isolate* isolate, JSONStream* stream) { | 178 void CodeCoverage::PrintToJSONStream(Isolate* isolate, JSONStream* stream) { |
| 179 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | 179 const GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 180 isolate, isolate->object_store()->libraries()); | 180 isolate, isolate->object_store()->libraries()); |
| 181 Library& lib = Library::Handle(); | 181 Library& lib = Library::Handle(); |
| 182 Class& cls = Class::Handle(); | 182 Class& cls = Class::Handle(); |
| 183 JSONObject coverage(stream); | 183 JSONObject coverage(stream); |
| 184 coverage.AddProperty("type", "CodeCoverage"); | 184 coverage.AddProperty("type", "CodeCoverage"); |
| 185 coverage.AddProperty("id", "coverage"); |
| 185 { | 186 { |
| 186 JSONArray jsarr(&coverage, "coverage"); | 187 JSONArray jsarr(&coverage, "coverage"); |
| 187 for (int i = 0; i < libs.Length(); i++) { | 188 for (int i = 0; i < libs.Length(); i++) { |
| 188 lib ^= libs.At(i); | 189 lib ^= libs.At(i); |
| 189 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); | 190 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); |
| 190 while (it.HasNext()) { | 191 while (it.HasNext()) { |
| 191 cls = it.GetNextClass(); | 192 cls = it.GetNextClass(); |
| 192 if (cls.EnsureIsFinalized(isolate) == Error::null()) { | 193 if (cls.EnsureIsFinalized(isolate) == Error::null()) { |
| 193 // Only classes that have been finalized do have a meaningful list of | 194 // Only classes that have been finalized do have a meaningful list of |
| 194 // functions. | 195 // functions. |
| 195 PrintClass(cls, jsarr); | 196 PrintClass(cls, jsarr); |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 | 202 |
| 202 | 203 |
| 203 } // namespace dart | 204 } // namespace dart |
| OLD | NEW |