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

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

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile 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
deleted file mode 100644
index 9bef5d0f1122ff40f0272caed16ade780b08f9da..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/inspector_protocol/String16_h.template
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef String16_h
-#define String16_h
-
-//#include "Collections.h"
-//#include "Platform.h"
-#include "{{config.class_export.header}}"
-
-#include <vector>
-
-namespace blink {
-namespace protocol {
-
-namespace internal {
-{{config.class_export.macro}} void intToStr(int, char*, size_t);
-{{config.class_export.macro}} void doubleToStr(double, char*, size_t);
-{{config.class_export.macro}} void doubleToStr3(double, char*, size_t);
-{{config.class_export.macro}} void doubleToStr6(double, char*, size_t);
-{{config.class_export.macro}} int strToInt(const char*, bool*);
-} // namespace internal
-
-template <typename T, typename C>
-class {{config.class_export.macro}} String16Base {
-public:
- static bool isASCII(C c)
- {
- return !(c & ~0x7F);
- }
-
- static bool isSpaceOrNewLine(C c)
- {
- return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
- }
-
- static T fromInteger(int number)
- {
- char buffer[50];
- internal::intToStr(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer));
- return T(buffer);
- }
-
- static T fromDouble(double number)
- {
- char buffer[100];
- internal::doubleToStr(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer));
- return T(buffer);
- }
-
- static T fromDoublePrecision3(double number)
- {
- char buffer[100];
- internal::doubleToStr3(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer));
- return T(buffer);
- }
-
- static T fromDoublePrecision6(double number)
- {
- char buffer[100];
- internal::doubleToStr6(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer));
- return T(buffer);
- }
-
- static int charactersToInteger(const C* characters, size_t length, bool* ok = nullptr)
- {
- std::vector<char> buffer;
- buffer.reserve(length + 1);
- for (size_t i = 0; i < length; ++i) {
- if (!isASCII(characters[i])) {
- if (ok)
- *ok = false;
- return 0;
- }
- buffer.push_back(static_cast<char>(characters[i]));
- }
- buffer.push_back('\0');
- return internal::strToInt(buffer.data(), ok);
- }
-
- int toInteger(bool* ok = nullptr) const
- {
- const C* characters = static_cast<const T&>(*this).characters16();
- size_t length = static_cast<const T&>(*this).length();
- return charactersToInteger(characters, length, ok);
- }
-
- T stripWhiteSpace() const
- {
- size_t length = static_cast<const T&>(*this).length();
- if (!length)
- return T();
-
- unsigned start = 0;
- unsigned end = length - 1;
- const C* characters = static_cast<const T&>(*this).characters16();
-
- // skip white space from start
- while (start <= end && isSpaceOrNewLine(characters[start]))
- ++start;
-
- // only white space
- if (start > end)
- return T();
-
- // skip white space from end
- while (end && isSpaceOrNewLine(characters[end]))
- --end;
-
- if (!start && end == length - 1)
- return T(static_cast<const T&>(*this));
- return T(characters + start, end + 1 - start);
- }
-};
-
-} // namespace protocol
-} // namespace blink
-
-#include "{{config.lib.string16_header}}"
-
-namespace blink {
-namespace protocol {
-
-class {{config.class_export.macro}} String16Builder {
-public:
- String16Builder();
- void append(const String16&);
- void append(UChar);
- void append(char);
- void append(const UChar*, size_t);
- void append(const char*, size_t);
- String16 toString();
- void reserveCapacity(size_t);
-
-private:
- std::vector<UChar> m_buffer;
-};
-
-} // namespace protocol
-} // namespace blink
-
-using String16 = blink::protocol::String16;
-using String16Builder = blink::protocol::String16Builder;
-
-#endif // !defined(String16_h)

Powered by Google App Engine
This is Rietveld 408576698