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

Unified Diff: runtime/vm/version_in.cc

Issue 14593004: Fix dartbug.com/10415: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/version.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/version_in.cc
===================================================================
--- runtime/vm/version_in.cc (revision 22412)
+++ runtime/vm/version_in.cc (working copy)
@@ -4,8 +4,28 @@
#include "vm/version.h"
+#include "vm/cpu.h"
+#include "vm/os.h"
+
namespace dart {
+// TODO(iposva): Avoid racy initialization.
+static const char* formatted_version = NULL;
+
+const char* Version::String() {
+ if (formatted_version == NULL) {
+ const char* format = "%s on \"%s_%s\"";
+ const char* os = OS::Name();
+ const char* arch = CPU::Id();
+
+ intptr_t len = OS::SNPrint(NULL, 0, format, str_, os, arch);
+ char* buffer = reinterpret_cast<char*>(malloc(len + 1));
+ OS::SNPrint(buffer, (len + 1), format, str_, os, arch);
+ formatted_version = buffer;
+ }
+ return formatted_version;
+}
+
const char* Version::str_ = "{{VERSION_STR}} ({{BUILD_TIME}})";
} // namespace dart
« no previous file with comments | « runtime/vm/version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698