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

Unified Diff: src/inspector/string-util.cc

Issue 2846673005: Roll third_party/inspector_protocol to efefa86c3183d307f0a0e53bf568fe57c5b58849 (Closed)
Patch Set: ac Created 3 years, 8 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 | « src/inspector/string-util.h ('k') | test/inspector/debugger/protocol-string-to-double-locale.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/string-util.cc
diff --git a/src/inspector/string-util.cc b/src/inspector/string-util.cc
index 31b2db572ddc59694bfcf28d373bb096a9e5eb7a..95d4247d14cb0c776bfbad6b16db2e036453c0f7 100644
--- a/src/inspector/string-util.cc
+++ b/src/inspector/string-util.cc
@@ -4,7 +4,9 @@
#include "src/inspector/string-util.h"
+#include "src/conversions.h"
#include "src/inspector/protocol/Protocol.h"
+#include "src/unicode-cache.h"
namespace v8_inspector {
@@ -92,6 +94,16 @@ bool stringViewStartsWith(const StringView& string, const char* prefix) {
namespace protocol {
+// static
+double StringUtil::toDouble(const char* s, size_t len, bool* isOk) {
+ v8::internal::UnicodeCache unicode_cache;
+ int flags = v8::internal::ALLOW_HEX | v8::internal::ALLOW_OCTAL |
+ v8::internal::ALLOW_BINARY;
+ double result = StringToDouble(&unicode_cache, s, flags);
+ *isOk = !std::isnan(result);
+ return result;
+}
+
std::unique_ptr<protocol::Value> StringUtil::parseJSON(
const StringView& string) {
if (!string.length()) return nullptr;
« no previous file with comments | « src/inspector/string-util.h ('k') | test/inspector/debugger/protocol-string-to-double-locale.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698