OLD | NEW |
(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 |
OLD | NEW |