Commit 3b3ae152 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

Roll third_party/inspector_protocol to efefa86c3183d307f0a0e53bf568fe57c5b58849

This roll includes:
  - [inspector_protocol] added StringUtil::toDouble method as requirement [1]

[1] https://codereview.chromium.org/2843223005/

BUG=712610
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2846113002
Cr-Commit-Position: refs/heads/master@{#467878}
parent 3e58482d
...@@ -45,6 +45,11 @@ class StringUtil { ...@@ -45,6 +45,11 @@ class StringUtil {
static String fromDouble(double number) { static String fromDouble(double number) {
return base::DoubleToString(number); return base::DoubleToString(number);
} }
static double toDouble(const char* s, size_t len, bool* ok) {
double v = 0.0;
*ok = base::StringToDouble(std::string(s, len), &v);
return *ok ? v : 0.0;
}
static void builderAppend(StringBuilder& builder, const String& s) { static void builderAppend(StringBuilder& builder, const String& s) {
builder.append(s); builder.append(s);
} }
......
...@@ -52,6 +52,11 @@ class CONTENT_EXPORT StringUtil { ...@@ -52,6 +52,11 @@ class CONTENT_EXPORT StringUtil {
s = "0" + s; s = "0" + s;
return s; return s;
} }
static double toDouble(const char* s, size_t len, bool* ok) {
double v = 0.0;
*ok = base::StringToDouble(std::string(s, len), &v);
return *ok ? v : 0.0;
}
static size_t find(const String& s, const char* needle) { static size_t find(const String& s, const char* needle) {
return s.find(needle); return s.find(needle);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "platform/wtf/Assertions.h" #include "platform/wtf/Assertions.h"
#include "platform/wtf/text/StringBuilder.h" #include "platform/wtf/text/StringBuilder.h"
#include "platform/wtf/text/StringHash.h" #include "platform/wtf/text/StringHash.h"
#include "platform/wtf/text/StringToNumber.h"
#include "platform/wtf/text/StringView.h" #include "platform/wtf/text/StringView.h"
#include "platform/wtf/text/WTFString.h" #include "platform/wtf/text/WTFString.h"
#include "v8/include/v8-inspector.h" #include "v8/include/v8-inspector.h"
...@@ -44,6 +45,9 @@ class CORE_EXPORT StringUtil { ...@@ -44,6 +45,9 @@ class CORE_EXPORT StringUtil {
static String fromDouble(double number) { static String fromDouble(double number) {
return Decimal::FromDouble(number).ToString(); return Decimal::FromDouble(number).ToString();
} }
static double toDouble(const char* s, size_t len, bool* ok) {
return WTF::CharactersToDouble(reinterpret_cast<const LChar*>(s), len, ok);
}
static size_t find(const String& s, const char* needle) { static size_t find(const String& s, const char* needle) {
return s.Find(needle); return s.Find(needle);
} }
......
...@@ -2,7 +2,7 @@ Name: inspector protocol ...@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/ URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0 Version: 0
Revision: 13768f332cacb5170d64b8fcce1887b78fec2d86 Revision: efefa86c3183d307f0a0e53bf568fe57c5b58849
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -51,19 +51,13 @@ double charactersToDouble(const uint16_t* characters, size_t length, bool* ok) ...@@ -51,19 +51,13 @@ double charactersToDouble(const uint16_t* characters, size_t length, bool* ok)
buffer.push_back(static_cast<char>(characters[i])); buffer.push_back(static_cast<char>(characters[i]));
} }
buffer.push_back('\0'); buffer.push_back('\0');
char* endptr; return StringUtil::toDouble(buffer.data(), length, ok);
double result = std::strtod(buffer.data(), &endptr);
*ok = !(*endptr);
return result;
} }
double charactersToDouble(const uint8_t* characters, size_t length, bool* ok) double charactersToDouble(const uint8_t* characters, size_t length, bool* ok)
{ {
std::string buffer(reinterpret_cast<const char*>(characters), length); std::string buffer(reinterpret_cast<const char*>(characters), length);
char* endptr; return StringUtil::toDouble(buffer.data(), length, ok);
double result = std::strtod(buffer.data(), &endptr);
*ok = !(*endptr);
return result;
} }
template<typename Char> template<typename Char>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment