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

Side by Side Diff: runtime/vm/coverage.cc

Issue 1331623002: Uses SNPRINT macro where possible. Otherwise uses #define for format. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add missing include Created 5 years, 3 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
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 Dart_FileOpenCallback file_open = Isolate::file_open_callback(); 240 Dart_FileOpenCallback file_open = Isolate::file_open_callback();
241 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); 241 Dart_FileWriteCallback file_write = Isolate::file_write_callback();
242 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 242 Dart_FileCloseCallback file_close = Isolate::file_close_callback();
243 if ((file_open == NULL) || (file_write == NULL) || (file_close == NULL)) { 243 if ((file_open == NULL) || (file_write == NULL) || (file_close == NULL)) {
244 return; 244 return;
245 } 245 }
246 246
247 JSONStream stream; 247 JSONStream stream;
248 PrintJSON(isolate, &stream, NULL, false); 248 PrintJSON(isolate, &stream, NULL, false);
249 249
250 const char* format = "%s/dart-cov-%" Pd "-%" Pd64 ".json";
251 intptr_t pid = OS::ProcessId(); 250 intptr_t pid = OS::ProcessId();
252 intptr_t len = OS::SNPrint(NULL, 0, format, 251 char* filename = OS::SCreate(Thread::Current()->zone(),
253 FLAG_coverage_dir, pid, isolate->main_port()); 252 "%s/dart-cov-%" Pd "-%" Pd64 ".json",
254 char* filename = Thread::Current()->zone()->Alloc<char>(len + 1); 253 FLAG_coverage_dir, pid, isolate->main_port());
255 OS::SNPrint(filename, len + 1, format,
256 FLAG_coverage_dir, pid, isolate->main_port());
257 void* file = (*file_open)(filename, true); 254 void* file = (*file_open)(filename, true);
258 if (file == NULL) { 255 if (file == NULL) {
259 OS::Print("Failed to write coverage file: %s\n", filename); 256 OS::Print("Failed to write coverage file: %s\n", filename);
260 return; 257 return;
261 } 258 }
262 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); 259 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file);
263 (*file_close)(file); 260 (*file_close)(file);
264 } 261 }
265 262
266 263
(...skipping 20 matching lines...) Expand all
287 cls = it.GetNextClass(); 284 cls = it.GetNextClass();
288 ASSERT(!cls.IsNull()); 285 ASSERT(!cls.IsNull());
289 PrintClass(lib, cls, jsarr, filter, as_call_sites); 286 PrintClass(lib, cls, jsarr, filter, as_call_sites);
290 } 287 }
291 } 288 }
292 } 289 }
293 } 290 }
294 291
295 292
296 } // namespace dart 293 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698