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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/String16.h

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/v8_inspector/String16.h
diff --git a/third_party/WebKit/Source/platform/v8_inspector/String16STL.h b/third_party/WebKit/Source/platform/v8_inspector/String16.h
similarity index 75%
rename from third_party/WebKit/Source/platform/v8_inspector/String16STL.h
rename to third_party/WebKit/Source/platform/v8_inspector/String16.h
index ffde6c72f52afd57fd979a326a38a2f7dd721b4b..1da6721cda806f93c1ef29d294071018480781ba 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/String16STL.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/String16.h
@@ -2,23 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef String16STL_h
-#define String16STL_h
+#ifndef String16_h
+#define String16_h
+
+#include "platform/PlatformExport.h"
#include <cctype>
#include <climits>
-#include <cstdlib>
#include <cstring>
#include <stdint.h>
#include <string>
#include <vector>
-using UChar = uint16_t;
+namespace v8_inspector {
-namespace blink {
-namespace protocol {
+using UChar = uint16_t;
-class String16 : public String16Base<String16, UChar> {
+class PLATFORM_EXPORT String16 {
public:
static const size_t kNotFound = static_cast<size_t>(-1);
@@ -34,7 +34,15 @@ public:
m_impl[i] = characters[i];
}
- String16 isolatedCopy() const { return String16(m_impl); }
+ static String16 fromInteger(int);
+ static String16 fromDouble(double);
+ static String16 fromDoublePrecision3(double);
+ static String16 fromDoublePrecision6(double);
+
+ double toDouble(bool* ok = nullptr) const;
+ int toInteger(bool* ok = nullptr) const;
+ String16 stripWhiteSpace() const;
+ bool startsWith(const char* prefix) const;
const UChar* characters16() const { return m_impl.c_str(); }
size_t length() const { return m_impl.length(); }
bool isEmpty() const { return !m_impl.length(); }
@@ -76,14 +84,28 @@ inline String16 operator+(const String16& a, const char* b) { return String16(a.
inline String16 operator+(const char* a, const String16& b) { return String16(String16(a).impl() + b.impl()); }
inline String16 operator+(const String16& a, const String16& b) { return String16(a.impl() + b.impl()); }
-} // namespace protocol
-} // namespace blink
+class PLATFORM_EXPORT 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 v8_inspector
#if !defined(__APPLE__) || defined(_LIBCPP_VERSION)
namespace std {
-template<> struct hash<blink::protocol::String16> {
- std::size_t operator()(const blink::protocol::String16& string) const
+template<> struct hash<v8_inspector::String16> {
+ std::size_t operator()(const v8_inspector::String16& string) const
{
return string.hash();
}
@@ -93,12 +115,4 @@ template<> struct hash<blink::protocol::String16> {
#endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION)
-class InspectorProtocolConvenienceStringType {
-public:
- // This class should not be ever instantiated, so we don't implement constructors.
- InspectorProtocolConvenienceStringType();
- InspectorProtocolConvenienceStringType(const blink::protocol::String16& other);
- operator blink::protocol::String16() const { return blink::protocol::String16(); };
-};
-
-#endif // !defined(String16STL_h)
+#endif // !defined(String16_h)

Powered by Google App Engine
This is Rietveld 408576698