Commit 5a566642 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] Roll inspector_protocol

New revision: 50a14c3884caf012f3a5fc666d5eb8033d8a184a

Change-Id: I7b4b99e8ec537373d3ec5b1390461824e58285b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1603217Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61394}
parent 5ae50165
...@@ -2,7 +2,7 @@ Name: inspector protocol ...@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/ URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0 Version: 0
Revision: 2039736177ee11d96a096cdab9c58cc1d78faa43 Revision: 50a14c3884caf012f3a5fc666d5eb8033d8a184a
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -2106,10 +2106,8 @@ Status ConvertCBORToJSON(const Platform& platform, ...@@ -2106,10 +2106,8 @@ Status ConvertCBORToJSON(const Platform& platform,
return ConvertCBORToJSONTmpl(platform, cbor, json); return ConvertCBORToJSONTmpl(platform, cbor, json);
} }
template <typename C> template <typename T, typename C>
Status ConvertJSONToCBORTmpl(const Platform& platform, Status ConvertJSONToCBORTmpl(const Platform& platform, span<T> json, C* cbor) {
span<uint8_t> json,
C* cbor) {
Status status; Status status;
std::unique_ptr<StreamingParserHandler> encoder = std::unique_ptr<StreamingParserHandler> encoder =
cbor::NewCBOREncoder(cbor, &status); cbor::NewCBOREncoder(cbor, &status);
...@@ -2121,10 +2119,20 @@ Status ConvertJSONToCBOR(const Platform& platform, ...@@ -2121,10 +2119,20 @@ Status ConvertJSONToCBOR(const Platform& platform,
std::string* cbor) { std::string* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor); return ConvertJSONToCBORTmpl(platform, json, cbor);
} }
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::string* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor);
}
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::vector<uint8_t>* cbor) { std::vector<uint8_t>* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor); return ConvertJSONToCBORTmpl(platform, json, cbor);
} }
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::vector<uint8_t>* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor);
}
} // namespace json } // namespace json
} // namespace v8_inspector_protocol_encoding } // namespace v8_inspector_protocol_encoding
...@@ -496,9 +496,15 @@ Status ConvertCBORToJSON(const Platform& platform, ...@@ -496,9 +496,15 @@ Status ConvertCBORToJSON(const Platform& platform,
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::vector<uint8_t>* cbor); std::vector<uint8_t>* cbor);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::vector<uint8_t>* cbor);
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::string* cbor); std::string* cbor);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::string* cbor);
} // namespace json } // namespace json
} // namespace v8_inspector_protocol_encoding } // namespace v8_inspector_protocol_encoding
......
...@@ -1788,5 +1788,29 @@ TYPED_TEST(ConvertJSONToCBORTest, RoundTripValidJson) { ...@@ -1788,5 +1788,29 @@ TYPED_TEST(ConvertJSONToCBORTest, RoundTripValidJson) {
} }
EXPECT_EQ(json, roundtrip_json); EXPECT_EQ(json, roundtrip_json);
} }
TYPED_TEST(ConvertJSONToCBORTest, RoundTripValidJson16) {
std::vector<uint16_t> json16 = {
'{', '"', 'm', 's', 'g', '"', ':', '"', 'H', 'e', 'l', 'l',
'o', ',', ' ', 0xd83c, 0xdf0e, '.', '"', ',', '"', 'l', 's', 't',
'"', ':', '[', '1', ',', '2', ',', '3', ']', '}'};
TypeParam cbor;
{
Status status = ConvertJSONToCBOR(
GetTestPlatform(), span<uint16_t>(json16.data(), json16.size()), &cbor);
EXPECT_EQ(Error::OK, status.error);
EXPECT_EQ(Status::npos(), status.pos);
}
TypeParam roundtrip_json;
{
Status status =
ConvertCBORToJSON(GetTestPlatform(), SpanFrom(cbor), &roundtrip_json);
EXPECT_EQ(Error::OK, status.error);
EXPECT_EQ(Status::npos(), status.pos);
}
std::string json = "{\"msg\":\"Hello, \\ud83c\\udf0e.\",\"lst\":[1,2,3]}";
TypeParam expected_json(json.begin(), json.end());
EXPECT_EQ(expected_json, roundtrip_json);
}
} // namespace json } // namespace json
} // namespace v8_inspector_protocol_encoding } // namespace v8_inspector_protocol_encoding
...@@ -2113,10 +2113,8 @@ Status ConvertCBORToJSON(const Platform& platform, ...@@ -2113,10 +2113,8 @@ Status ConvertCBORToJSON(const Platform& platform,
return ConvertCBORToJSONTmpl(platform, cbor, json); return ConvertCBORToJSONTmpl(platform, cbor, json);
} }
template <typename C> template <typename T, typename C>
Status ConvertJSONToCBORTmpl(const Platform& platform, Status ConvertJSONToCBORTmpl(const Platform& platform, span<T> json, C* cbor) {
span<uint8_t> json,
C* cbor) {
Status status; Status status;
std::unique_ptr<StreamingParserHandler> encoder = std::unique_ptr<StreamingParserHandler> encoder =
cbor::NewCBOREncoder(cbor, &status); cbor::NewCBOREncoder(cbor, &status);
...@@ -2128,11 +2126,21 @@ Status ConvertJSONToCBOR(const Platform& platform, ...@@ -2128,11 +2126,21 @@ Status ConvertJSONToCBOR(const Platform& platform,
std::string* cbor) { std::string* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor); return ConvertJSONToCBORTmpl(platform, json, cbor);
} }
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::string* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor);
}
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::vector<uint8_t>* cbor) { std::vector<uint8_t>* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor); return ConvertJSONToCBORTmpl(platform, json, cbor);
} }
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::vector<uint8_t>* cbor) {
return ConvertJSONToCBORTmpl(platform, json, cbor);
}
} // namespace json } // namespace json
{% for namespace in config.protocol.namespace %} {% for namespace in config.protocol.namespace %}
......
...@@ -504,9 +504,15 @@ Status ConvertCBORToJSON(const Platform& platform, ...@@ -504,9 +504,15 @@ Status ConvertCBORToJSON(const Platform& platform,
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::vector<uint8_t>* cbor); std::vector<uint8_t>* cbor);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::vector<uint8_t>* cbor);
Status ConvertJSONToCBOR(const Platform& platform, Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json, span<uint8_t> json,
std::string* cbor); std::string* cbor);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint16_t> json,
std::string* cbor);
} // namespace json } // namespace json
{% for namespace in config.protocol.namespace %} {% for namespace in config.protocol.namespace %}
......
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