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

Side by Side Diff: third_party/WebKit/Source/core/inspector/V8InspectorStringView.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: using WTF::StringView 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 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/V8InspectorStringView.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 String toCoreString(const v8_inspector::StringView& string)
19 {
20 if (string.is8Bit()) {
21 if (!string.characters8())
22 return String();
23 if (!string.length())
24 return emptyString();
25 return String(reinterpret_cast<const LChar*>(string.characters8()), stri ng.length());
26 }
27 if (!string.characters16())
28 return String();
29 if (!string.length())
30 return emptyString();
31 return String(reinterpret_cast<const UChar*>(string.characters16()), string. length());
32 }
33
34 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698