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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/String16_h.template

Issue 2260233002: [DevTools] Migrate v8_inspector/public from String16 to String{View,Buffer}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better Created 4 years, 4 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
Index: third_party/WebKit/Source/platform/inspector_protocol/String16_h.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/String16_h.template b/third_party/WebKit/Source/platform/inspector_protocol/String16_h.template
index e6f8f0c78465ae686ac3e2bf089f633eb56862ee..67086a3a289f6355aa94b42ae991ba591606f629 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/String16_h.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/String16_h.template
@@ -80,6 +80,12 @@ public:
return internal::strToDouble(buffer.data(), ok);
}
+ static double charactersToDouble(const uint8_t* characters, size_t length, bool* ok = nullptr)
+ {
+ std::string buffer(reinterpret_cast<const char*>(characters), length);
+ return internal::strToDouble(buffer.c_str(), ok);
+ }
+
static int charactersToInteger(const C* characters, size_t length, bool* ok = nullptr)
{
std::vector<char> buffer;
@@ -136,17 +142,6 @@ public:
return T(static_cast<const T&>(*this));
return T(characters + start, end + 1 - start);
}
-
- bool startsWith(const char* prefix) const
- {
- const C* characters = static_cast<const T&>(*this).characters16();
- size_t length = static_cast<const T&>(*this).length();
- for (size_t i = 0, j = 0; prefix[j] && i < length; ++i, ++j) {
- if (characters[i] != prefix[j])
- return false;
- }
- return true;
- }
};
} // namespace protocol

Powered by Google App Engine
This is Rietveld 408576698