Index: src/inspector/string-16.cc |
diff --git a/src/inspector/string-16.cc b/src/inspector/string-16.cc |
index f6084602f421085127603f146f2c9618eb1b1962..e39b87c17f8f035201e9ea4b4835ea3da6c52800 100644 |
--- a/src/inspector/string-16.cc |
+++ b/src/inspector/string-16.cc |
@@ -8,10 +8,8 @@ |
#include <cctype> |
#include <cstdlib> |
#include <cstring> |
-#include <iomanip> |
#include <limits> |
#include <locale> |
-#include <sstream> |
#include <string> |
#include "src/base/platform/platform.h" |
@@ -383,19 +381,26 @@ |
// static |
String16 String16::fromDouble(double number) { |
- std::ostringstream s; |
- s.imbue(std::locale("C")); |
- s << std::fixed << std::setprecision(std::numeric_limits<double>::digits10) |
- << number; |
- return String16(s.str().c_str()); |
+ const size_t kBufferSize = 100; |
+ char buffer[kBufferSize]; |
+ v8::base::OS::SNPrintF(buffer, kBufferSize, "%f", number); |
+ return String16(buffer); |
} |
// static |
-String16 String16::fromDouble(double number, int precision) { |
- std::ostringstream s; |
- s.imbue(std::locale("C")); |
- s << std::fixed << std::setprecision(precision) << number; |
- return String16(s.str().c_str()); |
+String16 String16::fromDoublePrecision3(double number) { |
+ const size_t kBufferSize = 100; |
+ char buffer[kBufferSize]; |
+ v8::base::OS::SNPrintF(buffer, kBufferSize, "%.3g", number); |
+ return String16(buffer); |
+} |
+ |
+// static |
+String16 String16::fromDoublePrecision6(double number) { |
+ const size_t kBufferSize = 100; |
+ char buffer[kBufferSize]; |
+ v8::base::OS::SNPrintF(buffer, kBufferSize, "%.6g", number); |
+ return String16(buffer); |
} |
int String16::toInteger(bool* ok) const { |