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

Unified Diff: runtime/vm/zone.cc

Issue 1284263002: Start TimelineAnalysis utility (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/zone.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone.cc
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
index 58fb1d1900d22f6507853ad983749745de5c070a..c271991a33c17b1a73cee4f36e94bc3912cf12a8 100644
--- a/runtime/vm/zone.cc
+++ b/runtime/vm/zone.cc
@@ -203,16 +203,25 @@ void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
char* Zone::PrintToString(const char* format, ...) {
va_list args;
va_start(args, format);
- intptr_t len = OS::VSNPrint(NULL, 0, format, args);
- va_end(args);
+ return VPrint(format, args);
+}
- char* buffer = Alloc<char>(len + 1);
- va_list args2;
- va_start(args2, format);
- OS::VSNPrint(buffer, (len + 1), format, args2);
- va_end(args2);
+char* Zone::VPrint(const char* format, va_list args) {
+ // Measure.
+ va_list measure_args;
+ va_copy(measure_args, args);
+ intptr_t len = OS::VSNPrint(NULL, 0, format, measure_args);
+ va_end(measure_args);
+
+ // Print.
+ char* buffer = Alloc<char>(len + 1);
+ va_list print_args;
+ va_copy(print_args, args);
+ OS::VSNPrint(buffer, (len + 1), format, print_args);
+ va_end(print_args);
return buffer;
}
+
} // namespace dart
« no previous file with comments | « runtime/vm/zone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698