Index: src/inspector/string-16.cc |
diff --git a/src/inspector/string-16.cc b/src/inspector/string-16.cc |
index ddccc09385c737e333c75975ff00644d95ae3116..09909a911bb158784ba3159e3bcc287a3445b85f 100644 |
--- a/src/inspector/string-16.cc |
+++ b/src/inspector/string-16.cc |
@@ -447,6 +447,26 @@ void String16Builder::append(const char* characters, size_t length) { |
m_buffer.insert(m_buffer.end(), characters, characters + length); |
} |
+void String16Builder::appendNumber(int number) { |
+ const int kBufferSize = 11; |
+ char buffer[kBufferSize]; |
+ int chars = v8::base::OS::SNPrintF(buffer, kBufferSize, "%d", number); |
+ DCHECK_GT(kBufferSize, chars); |
+ m_buffer.insert(m_buffer.end(), buffer, buffer + chars); |
+} |
+ |
+void String16Builder::appendNumber(size_t number) { |
+ const int kBufferSize = 20; |
+ char buffer[kBufferSize]; |
+#if !defined(_WIN32) && !defined(_WIN64) |
+ int chars = v8::base::OS::SNPrintF(buffer, kBufferSize, "%zu", number); |
+#else |
+ int chars = v8::base::OS::SNPrintF(buffer, kBufferSize, "%Iu", number); |
+#endif |
+ DCHECK_GT(kBufferSize, chars); |
+ m_buffer.insert(m_buffer.end(), buffer, buffer + chars); |
+} |
+ |
String16 String16Builder::toString() { |
return String16(m_buffer.data(), m_buffer.size()); |
} |