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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/inspector/V8InspectorString.h"
6
7 namespace blink {
8
9 v8_inspector::StringView toV8InspectorStringView(const StringView& string)
10 {
11 if (string.isNull())
12 return v8_inspector::StringView();
13 if (string.is8Bit())
14 return v8_inspector::StringView(reinterpret_cast<const uint8_t*>(string. characters8()), string.length());
15 return v8_inspector::StringView(reinterpret_cast<const uint16_t*>(string.cha racters16()), string.length());
16 }
17
18 std::unique_ptr<v8_inspector::StringBuffer> toV8InspectorStringBuffer(const Stri ngView& string)
19 {
20 return v8_inspector::StringBuffer::create(toV8InspectorStringView(string));
21 }
22
23 String toCoreString(const v8_inspector::StringView& string)
24 {
25 if (string.is8Bit())
26 return String(reinterpret_cast<const LChar*>(string.characters8()), stri ng.length());
27 return String(reinterpret_cast<const UChar*>(string.characters16()), string. length());
28 }
29
30 String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer)
31 {
32 if (!buffer)
33 return String();
34 return toCoreString(buffer->string());
35 }
36
37 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698