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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/String16WTF.cpp

Issue 1779033003: DevTools: always use 16bit strings for inspector protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/String16WTF.cpp
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/String16WTF.cpp b/third_party/WebKit/Source/platform/inspector_protocol/String16WTF.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..387ecc3f48c45c98d8d89359ac269bbc1738d282
--- /dev/null
+++ b/third_party/WebKit/Source/platform/inspector_protocol/String16WTF.cpp
@@ -0,0 +1,47 @@
+// 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.
+
+#include "platform/inspector_protocol/String16WTF.h"
+
+namespace blink {
+namespace protocol {
+
+String16::String16(const String16& other) : m_impl(other.m_impl) { }
+
+String16::String16(const UChar* u, unsigned length) : m_impl(u, length) { }
+
+String16::String16(const char* characters) : String16(characters, strlen(characters)) { }
+
+String16::String16(const WTF::String& other)
+{
+ if (other.isNull())
+ return;
+ if (!other.is8Bit()) {
+ m_impl = other;
+ return;
+ }
+
+ UChar* data;
+ const LChar* characters = other.characters8();
+ size_t length = other.length();
+ m_impl = String::createUninitialized(length, data);
+ for (size_t i = 0; i < length; ++i)
+ data[i] = characters[i];
+}
+
+String16::String16(const char* characters, size_t length)
+{
+ UChar* data;
+ m_impl = String::createUninitialized(length, data);
+ for (size_t i = 0; i < length; ++i)
+ data[i] = characters[i];
+}
+
+String16 String16::createUninitialized(unsigned length, UChar*& data)
+{
+ return String::createUninitialized(length, data);
+}
+
+} // namespace protocol
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698