| Index: third_party/WebKit/Source/platform/inspector_protocol/Parser_cpp.template
|
| diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Parser_cpp.template b/third_party/WebKit/Source/platform/inspector_protocol/Parser_cpp.template
|
| index c6449c8a7026b32aca98cf0c3bc9df9a75e77968..b58732a401409747e8ca90b7ac0be8dddaab86e9 100644
|
| --- a/third_party/WebKit/Source/platform/inspector_protocol/Parser_cpp.template
|
| +++ b/third_party/WebKit/Source/platform/inspector_protocol/Parser_cpp.template
|
| @@ -2,8 +2,9 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -namespace blink {
|
| -namespace protocol {
|
| +{% for namespace in config.protocol.namespace %}
|
| +namespace {{namespace}} {
|
| +{% endfor %}
|
|
|
| namespace {
|
|
|
| @@ -33,6 +34,11 @@ bool isASCII(uint16_t c)
|
| return !(c & ~0x7F);
|
| }
|
|
|
| +bool isSpaceOrNewLine(uint16_t c)
|
| +{
|
| + return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
|
| +}
|
| +
|
| double charactersToDouble(const uint16_t* characters, size_t length, bool* ok)
|
| {
|
| std::vector<char> buffer;
|
| @@ -234,7 +240,7 @@ template<typename Char>
|
| void skipWhitespaceAndComments(const Char* start, const Char* end, const Char** whitespaceEnd)
|
| {
|
| while (start < end) {
|
| - if (String16::isSpaceOrNewLine(*start)) {
|
| + if (isSpaceOrNewLine(*start)) {
|
| ++start;
|
| } else if (*start == '/') {
|
| const Char* commentEnd;
|
| @@ -324,10 +330,10 @@ int hexToInt(Char c)
|
| }
|
|
|
| template<typename Char>
|
| -bool decodeString(const Char* start, const Char* end, String16Builder* output)
|
| +bool decodeString(const Char* start, const Char* end, StringBuilder* output)
|
| {
|
| while (start < end) {
|
| - UChar c = *start++;
|
| + uint16_t c = *start++;
|
| if ('\\' != c) {
|
| output->append(c);
|
| continue;
|
| @@ -378,7 +384,7 @@ bool decodeString(const Char* start, const Char* end, String16Builder* output)
|
| }
|
|
|
| template<typename Char>
|
| -bool decodeString(const Char* start, const Char* end, String16* output)
|
| +bool decodeString(const Char* start, const Char* end, String* output)
|
| {
|
| if (start == end) {
|
| *output = "";
|
| @@ -386,8 +392,8 @@ bool decodeString(const Char* start, const Char* end, String16* output)
|
| }
|
| if (start > end)
|
| return false;
|
| - String16Builder buffer;
|
| - buffer.reserveCapacity(end - start);
|
| + StringBuilder buffer;
|
| + StringUtil::builderReserve(buffer, end - start);
|
| if (!decodeString(start, end, &buffer))
|
| return false;
|
| *output = buffer.toString();
|
| @@ -429,7 +435,7 @@ std::unique_ptr<Value> buildValue(const Char* start, const Char* end, const Char
|
| break;
|
| }
|
| case StringLiteral: {
|
| - String16 value;
|
| + String value;
|
| bool ok = decodeString(tokenStart + 1, tokenEnd - 1, &value);
|
| if (!ok)
|
| return nullptr;
|
| @@ -471,7 +477,7 @@ std::unique_ptr<Value> buildValue(const Char* start, const Char* end, const Char
|
| while (token != ObjectEnd) {
|
| if (token != StringLiteral)
|
| return nullptr;
|
| - String16 key;
|
| + String key;
|
| if (!decodeString(tokenStart + 1, tokenEnd - 1, &key))
|
| return nullptr;
|
| start = tokenEnd;
|
| @@ -538,12 +544,6 @@ std::unique_ptr<Value> parseJSON(const uint8_t* characters, unsigned length)
|
| return parseJSONInternal<uint8_t>(characters, length);
|
| }
|
|
|
| -std::unique_ptr<Value> parseJSON(const String16& json)
|
| -{
|
| - if (json.isEmpty())
|
| - return nullptr;
|
| - return parseJSONInternal<uint16_t>(reinterpret_cast<const uint16_t*>(json.characters16()), json.length());
|
| -}
|
| -
|
| -} // namespace protocol
|
| -} // namespace blink
|
| +{% for namespace in config.protocol.namespace %}
|
| +} // namespace {{namespace}}
|
| +{% endfor %}
|
|
|