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

Unified Diff: third_party/WebKit/Source/core/inspector/V8InspectorString.cpp

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: styling 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/core/inspector/V8InspectorString.cpp
diff --git a/third_party/WebKit/Source/core/inspector/V8InspectorString.cpp b/third_party/WebKit/Source/core/inspector/V8InspectorString.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..43ec37dfc551e1c0386e413ce71fc2b733561532
--- /dev/null
+++ b/third_party/WebKit/Source/core/inspector/V8InspectorString.cpp
@@ -0,0 +1,37 @@
+// 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 "core/inspector/V8InspectorString.h"
+
+namespace blink {
+
+v8_inspector::StringView toV8InspectorStringView(const StringView& string)
+{
+ if (string.isNull())
+ return v8_inspector::StringView();
+ if (string.is8Bit())
+ return v8_inspector::StringView(reinterpret_cast<const uint8_t*>(string.characters8()), string.length());
+ return v8_inspector::StringView(reinterpret_cast<const uint16_t*>(string.characters16()), string.length());
+}
+
+std::unique_ptr<v8_inspector::StringBuffer> toV8InspectorStringBuffer(const StringView& string)
+{
+ return v8_inspector::StringBuffer::create(toV8InspectorStringView(string));
+}
+
+String toCoreString(const v8_inspector::StringView& string)
+{
+ if (string.is8Bit())
+ return String(reinterpret_cast<const LChar*>(string.characters8()), string.length());
+ return String(reinterpret_cast<const UChar*>(string.characters16()), string.length());
+}
+
+String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer)
+{
+ if (!buffer)
+ return String();
+ return toCoreString(buffer->string());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698