Chromium Code Reviews| 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; |
|
dgozman
2017/04/27 23:03:48
This class looks huuuge.
kozy
2017/04/27 23:31:00
sizeof(UnicodeCache) == 3624 bytes, all member con
|
| + 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; |