| 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/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 cls = it.GetNextClass(); | 105 cls = it.GetNextClass(); |
| 106 if (cls.is_finalized()) { | 106 if (cls.is_finalized()) { |
| 107 // Only classes that have been finalized do have a meaningful list of | 107 // Only classes that have been finalized do have a meaningful list of |
| 108 // functions. | 108 // functions. |
| 109 PrintClass(cls, jsarr); | 109 PrintClass(cls, jsarr); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 const char* format = "%s/dart-cov-%"Pd"-%"Pd".json"; | 115 const char* format = "%s/dart-cov-%" Pd "-%" Pd ".json"; |
| 116 intptr_t pid = OS::ProcessId(); | 116 intptr_t pid = OS::ProcessId(); |
| 117 intptr_t len = OS::SNPrint(NULL, 0, format, | 117 intptr_t len = OS::SNPrint(NULL, 0, format, |
| 118 FLAG_coverage_dir, pid, isolate->main_port()); | 118 FLAG_coverage_dir, pid, isolate->main_port()); |
| 119 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 119 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 120 OS::SNPrint(filename, len + 1, format, | 120 OS::SNPrint(filename, len + 1, format, |
| 121 FLAG_coverage_dir, pid, isolate->main_port()); | 121 FLAG_coverage_dir, pid, isolate->main_port()); |
| 122 void* file = (*file_open)(filename, true); | 122 void* file = (*file_open)(filename, true); |
| 123 if (file == NULL) { | 123 if (file == NULL) { |
| 124 OS::Print("Failed to write coverage file: %s\n", filename); | 124 OS::Print("Failed to write coverage file: %s\n", filename); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); | 127 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); |
| 128 (*file_close)(file); | 128 (*file_close)(file); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace dart | 131 } // namespace dart |
| OLD | NEW |