Commit d4206d50 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] Extract UTF8<->UTF16 routines from string-16{.h,.cc}.

This will allow me to reuse the routines for the
inspector_protocol/encoding/encoding_test, rather than copy them.
I've already verified that this works.

Change-Id: I5b61e4f48c2d00d9d0a5305c9790093c66b3c765
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1600360
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61355}
parent 6e402603
......@@ -80,8 +80,20 @@ v8_header_set("inspector_test_headers") {
]
}
v8_source_set("inspector_string_conversions") {
sources = [
"v8-string-conversions.cc",
"v8-string-conversions.h",
]
configs = [ "../..:internal_config_base" ]
deps = [
"../..:v8_libbase",
]
}
v8_source_set("inspector") {
deps = [
":inspector_string_conversions",
"../..:v8_version",
"../../third_party/inspector_protocol:encoding",
]
......
This diff is collapsed.
......@@ -30,6 +30,7 @@ class String16 {
String16(const char* characters); // NOLINT(runtime/explicit)
String16(const char* characters, size_t size);
explicit String16(const std::basic_string<UChar>& impl);
explicit String16(std::basic_string<UChar>&& impl);
String16& operator=(const String16&) V8_NOEXCEPT = default;
String16& operator=(String16&&) V8_NOEXCEPT = default;
......
This diff is collapsed.
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
#define V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
#include <string>
// Conversion routines between UT8 and UTF16, used by string-16.{h,cc}. You may
// want to use string-16.h directly rather than these.
namespace v8_inspector {
std::basic_string<uint16_t> UTF8ToUTF16(const char* stringStart, size_t length);
std::string UTF16ToUTF8(const uint16_t* stringStart, size_t length);
} // namespace v8_inspector
#endif // V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment