| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/inspector/V8InspectorString.h" | 5 #include "core/inspector/V8InspectorString.h" |
| 6 | 6 |
| 7 #include "core/inspector/protocol/Protocol.h" |
| 8 |
| 7 namespace blink { | 9 namespace blink { |
| 8 | 10 |
| 9 v8_inspector::StringView toV8InspectorStringView(const StringView& string) | 11 v8_inspector::StringView toV8InspectorStringView(const StringView& string) |
| 10 { | 12 { |
| 11 if (string.isNull()) | 13 if (string.isNull()) |
| 12 return v8_inspector::StringView(); | 14 return v8_inspector::StringView(); |
| 13 if (string.is8Bit()) | 15 if (string.is8Bit()) |
| 14 return v8_inspector::StringView(reinterpret_cast<const uint8_t*>(string.
characters8()), string.length()); | 16 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()); | 17 return v8_inspector::StringView(reinterpret_cast<const uint16_t*>(string.cha
racters16()), string.length()); |
| 16 } | 18 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 return String(reinterpret_cast<const UChar*>(string.characters16()), string.
length()); | 29 return String(reinterpret_cast<const UChar*>(string.characters16()), string.
length()); |
| 28 } | 30 } |
| 29 | 31 |
| 30 String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer) | 32 String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer) |
| 31 { | 33 { |
| 32 if (!buffer) | 34 if (!buffer) |
| 33 return String(); | 35 return String(); |
| 34 return toCoreString(buffer->string()); | 36 return toCoreString(buffer->string()); |
| 35 } | 37 } |
| 36 | 38 |
| 39 namespace protocol { |
| 40 |
| 41 std::unique_ptr<protocol::Value> parseJSON(const String& string) |
| 42 { |
| 43 if (string.isNull()) |
| 44 return nullptr; |
| 45 if (string.is8Bit()) |
| 46 return parseJSON(reinterpret_cast<const uint8_t*>(string.characters8()),
string.length()); |
| 47 return parseJSON(reinterpret_cast<const uint16_t*>(string.characters16()), s
tring.length()); |
| 48 } |
| 49 |
| 50 } // namespace protocol |
| 51 |
| 37 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |