| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return; | 245 return; |
| 246 } | 246 } |
| 247 | 247 |
| 248 JSONStream stream; | 248 JSONStream stream; |
| 249 PrintJSON(isolate, &stream, NULL, false); | 249 PrintJSON(isolate, &stream, NULL, false); |
| 250 | 250 |
| 251 const char* format = "%s/dart-cov-%" Pd "-%" Pd ".json"; | 251 const char* format = "%s/dart-cov-%" Pd "-%" Pd ".json"; |
| 252 intptr_t pid = OS::ProcessId(); | 252 intptr_t pid = OS::ProcessId(); |
| 253 intptr_t len = OS::SNPrint(NULL, 0, format, | 253 intptr_t len = OS::SNPrint(NULL, 0, format, |
| 254 FLAG_coverage_dir, pid, isolate->main_port()); | 254 FLAG_coverage_dir, pid, isolate->main_port()); |
| 255 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 255 char* filename = Thread::Current()->zone()->Alloc<char>(len + 1); |
| 256 OS::SNPrint(filename, len + 1, format, | 256 OS::SNPrint(filename, len + 1, format, |
| 257 FLAG_coverage_dir, pid, isolate->main_port()); | 257 FLAG_coverage_dir, pid, isolate->main_port()); |
| 258 void* file = (*file_open)(filename, true); | 258 void* file = (*file_open)(filename, true); |
| 259 if (file == NULL) { | 259 if (file == NULL) { |
| 260 OS::Print("Failed to write coverage file: %s\n", filename); | 260 OS::Print("Failed to write coverage file: %s\n", filename); |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); | 263 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); |
| 264 (*file_close)(file); | 264 (*file_close)(file); |
| 265 } | 265 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 288 cls = it.GetNextClass(); | 288 cls = it.GetNextClass(); |
| 289 ASSERT(!cls.IsNull()); | 289 ASSERT(!cls.IsNull()); |
| 290 PrintClass(lib, cls, jsarr, filter, as_call_sites); | 290 PrintClass(lib, cls, jsarr, filter, as_call_sites); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 | 296 |
| 297 } // namespace dart | 297 } // namespace dart |
| OLD | NEW |