| 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" | 7 #include "core/inspector/protocol/Protocol.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer) { | 36 String toCoreString(std::unique_ptr<v8_inspector::StringBuffer> buffer) { |
| 37 if (!buffer) | 37 if (!buffer) |
| 38 return String(); | 38 return String(); |
| 39 return toCoreString(buffer->string()); | 39 return toCoreString(buffer->string()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 namespace protocol { | 42 namespace protocol { |
| 43 | 43 |
| 44 std::unique_ptr<protocol::Value> parseJSON(const String& string) { | 44 // static |
| 45 std::unique_ptr<protocol::Value> StringUtil::parseJSON(const String& string) { |
| 45 if (string.isNull()) | 46 if (string.isNull()) |
| 46 return nullptr; | 47 return nullptr; |
| 47 if (string.is8Bit()) | 48 if (string.is8Bit()) { |
| 48 return parseJSON(reinterpret_cast<const uint8_t*>(string.characters8()), | 49 return parseJSONCharacters( |
| 49 string.length()); | 50 reinterpret_cast<const uint8_t*>(string.characters8()), |
| 50 return parseJSON(reinterpret_cast<const uint16_t*>(string.characters16()), | 51 string.length()); |
| 51 string.length()); | 52 } |
| 53 return parseJSONCharacters( |
| 54 reinterpret_cast<const uint16_t*>(string.characters16()), |
| 55 string.length()); |
| 52 } | 56 } |
| 53 | 57 |
| 54 } // namespace protocol | 58 } // namespace protocol |
| 55 | 59 |
| 56 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |