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

[DevTools] Roll inspector_protocol for v8.

To Revision 16b370abe6f4b59efea00377473b5dddb438defb.

Also make roll.py executable (chmod u+x roll.py).

Change-Id: Ib3b3767f7fc9c3eef044779c142f62f3d6923242
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1568651Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60883}
parent 96e3b97b
...@@ -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: a7423d8ca937e658ab3b85e3b02676bced145ba6 Revision: 16b370abe6f4b59efea00377473b5dddb438defb
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -105,6 +105,8 @@ enum class Error { ...@@ -105,6 +105,8 @@ enum class Error {
CBOR_STRING8_MUST_BE_7BIT = 0x1c, CBOR_STRING8_MUST_BE_7BIT = 0x1c,
CBOR_TRAILING_JUNK = 0x1d, CBOR_TRAILING_JUNK = 0x1d,
CBOR_MAP_START_EXPECTED = 0x1e, CBOR_MAP_START_EXPECTED = 0x1e,
CBOR_MAP_STOP_EXPECTED = 0x1f,
CBOR_ENVELOPE_SIZE_LIMIT_EXCEEDED = 0x20,
}; };
// A status value with position that can be copied. The default status // A status value with position that can be copied. The default status
...@@ -197,32 +199,39 @@ uint8_t EncodeStop(); ...@@ -197,32 +199,39 @@ uint8_t EncodeStop();
// Encodes |value| as |UNSIGNED| (major type 0) iff >= 0, or |NEGATIVE| // Encodes |value| as |UNSIGNED| (major type 0) iff >= 0, or |NEGATIVE|
// (major type 1) iff < 0. // (major type 1) iff < 0.
void EncodeInt32(int32_t value, std::vector<uint8_t>* out); void EncodeInt32(int32_t value, std::vector<uint8_t>* out);
void EncodeInt32(int32_t value, std::string* out);
// Encodes a UTF16 string as a BYTE_STRING (major type 2). Each utf16 // Encodes a UTF16 string as a BYTE_STRING (major type 2). Each utf16
// character in |in| is emitted with most significant byte first, // character in |in| is emitted with most significant byte first,
// appending to |out|. // appending to |out|.
void EncodeString16(span<uint16_t> in, std::vector<uint8_t>* out); void EncodeString16(span<uint16_t> in, std::vector<uint8_t>* out);
void EncodeString16(span<uint16_t> in, std::string* out);
// Encodes a UTF8 string |in| as STRING (major type 3). // Encodes a UTF8 string |in| as STRING (major type 3).
void EncodeString8(span<uint8_t> in, std::vector<uint8_t>* out); void EncodeString8(span<uint8_t> in, std::vector<uint8_t>* out);
void EncodeString8(span<uint8_t> in, std::string* out);
// Encodes the given |latin1| string as STRING8. // Encodes the given |latin1| string as STRING8.
// If any non-ASCII character is present, it will be represented // If any non-ASCII character is present, it will be represented
// as a 2 byte UTF8 sequence. // as a 2 byte UTF8 sequence.
void EncodeFromLatin1(span<uint8_t> latin1, std::vector<uint8_t>* out); void EncodeFromLatin1(span<uint8_t> latin1, std::vector<uint8_t>* out);
void EncodeFromLatin1(span<uint8_t> latin1, std::string* out);
// Encodes the given |utf16| string as STRING8 if it's entirely US-ASCII. // Encodes the given |utf16| string as STRING8 if it's entirely US-ASCII.
// Otherwise, encodes as STRING16. // Otherwise, encodes as STRING16.
void EncodeFromUTF16(span<uint16_t> utf16, std::vector<uint8_t>* out); void EncodeFromUTF16(span<uint16_t> utf16, std::vector<uint8_t>* out);
void EncodeFromUTF16(span<uint16_t> utf16, std::string* out);
// Encodes arbitrary binary data in |in| as a BYTE_STRING (major type 2) with // Encodes arbitrary binary data in |in| as a BYTE_STRING (major type 2) with
// definitive length, prefixed with tag 22 indicating expected conversion to // definitive length, prefixed with tag 22 indicating expected conversion to
// base64 (see RFC 7049, Table 3 and Section 2.4.4.2). // base64 (see RFC 7049, Table 3 and Section 2.4.4.2).
void EncodeBinary(span<uint8_t> in, std::vector<uint8_t>* out); void EncodeBinary(span<uint8_t> in, std::vector<uint8_t>* out);
void EncodeBinary(span<uint8_t> in, std::string* out);
// Encodes / decodes a double as Major type 7 (SIMPLE_VALUE), // Encodes / decodes a double as Major type 7 (SIMPLE_VALUE),
// with additional info = 27, followed by 8 bytes in big endian. // with additional info = 27, followed by 8 bytes in big endian.
void EncodeDouble(double value, std::vector<uint8_t>* out); void EncodeDouble(double value, std::vector<uint8_t>* out);
void EncodeDouble(double value, std::string* out);
// ============================================================================= // =============================================================================
// cbor::EnvelopeEncoder - for wrapping submessages // cbor::EnvelopeEncoder - for wrapping submessages
...@@ -241,9 +250,11 @@ class EnvelopeEncoder { ...@@ -241,9 +250,11 @@ class EnvelopeEncoder {
// byte size in |byte_size_pos_|. Also emits empty bytes for the // byte size in |byte_size_pos_|. Also emits empty bytes for the
// byte sisze so that encoding can continue. // byte sisze so that encoding can continue.
void EncodeStart(std::vector<uint8_t>* out); void EncodeStart(std::vector<uint8_t>* out);
void EncodeStart(std::string* out);
// This records the current size in |out| at position byte_size_pos_. // This records the current size in |out| at position byte_size_pos_.
// Returns true iff successful. // Returns true iff successful.
bool EncodeStop(std::vector<uint8_t>* out); bool EncodeStop(std::vector<uint8_t>* out);
bool EncodeStop(std::string* out);
private: private:
std::size_t byte_size_pos_ = 0; std::size_t byte_size_pos_ = 0;
...@@ -260,6 +271,8 @@ class EnvelopeEncoder { ...@@ -260,6 +271,8 @@ class EnvelopeEncoder {
std::unique_ptr<StreamingParserHandler> NewCBOREncoder( std::unique_ptr<StreamingParserHandler> NewCBOREncoder(
std::vector<uint8_t>* out, std::vector<uint8_t>* out,
Status* status); Status* status);
std::unique_ptr<StreamingParserHandler> NewCBOREncoder(std::string* out,
Status* status);
// ============================================================================= // =============================================================================
// cbor::CBORTokenizer - for parsing individual CBOR items // cbor::CBORTokenizer - for parsing individual CBOR items
...@@ -389,6 +402,20 @@ class CBORTokenizer { ...@@ -389,6 +402,20 @@ class CBORTokenizer {
// that case. // that case.
void ParseCBOR(span<uint8_t> bytes, StreamingParserHandler* out); void ParseCBOR(span<uint8_t> bytes, StreamingParserHandler* out);
// =============================================================================
// cbor::AppendString8EntryToMap - for limited in-place editing of messages
// =============================================================================
// Modifies the |cbor| message by appending a new key/value entry at the end
// of the map. Patches up the envelope size; Status.ok() iff successful.
// If not successful, |cbor| may be corrupted after this call.
Status AppendString8EntryToCBORMap(span<uint8_t> string8_key,
span<uint8_t> string8_value,
std::vector<uint8_t>* cbor);
Status AppendString8EntryToCBORMap(span<uint8_t> string8_key,
span<uint8_t> string8_value,
std::string* cbor);
namespace internals { // Exposed only for writing tests. namespace internals { // Exposed only for writing tests.
int8_t ReadTokenStart(span<uint8_t> bytes, int8_t ReadTokenStart(span<uint8_t> bytes,
cbor::MajorType* type, cbor::MajorType* type,
...@@ -397,6 +424,9 @@ int8_t ReadTokenStart(span<uint8_t> bytes, ...@@ -397,6 +424,9 @@ int8_t ReadTokenStart(span<uint8_t> bytes,
void WriteTokenStart(cbor::MajorType type, void WriteTokenStart(cbor::MajorType type,
uint64_t value, uint64_t value,
std::vector<uint8_t>* encoded); std::vector<uint8_t>* encoded);
void WriteTokenStart(cbor::MajorType type,
uint64_t value,
std::string* encoded);
} // namespace internals } // namespace internals
} // namespace cbor } // namespace cbor
...@@ -424,6 +454,10 @@ class Platform { ...@@ -424,6 +454,10 @@ class Platform {
// Except for calling the HandleError routine at any time, the client // Except for calling the HandleError routine at any time, the client
// code must call the Handle* methods in an order in which they'd occur // code must call the Handle* methods in an order in which they'd occur
// in valid JSON; otherwise we may crash (the code uses assert). // in valid JSON; otherwise we may crash (the code uses assert).
std::unique_ptr<StreamingParserHandler> NewJSONEncoder(
const Platform* platform,
std::vector<uint8_t>* out,
Status* status);
std::unique_ptr<StreamingParserHandler> NewJSONEncoder(const Platform* platform, std::unique_ptr<StreamingParserHandler> NewJSONEncoder(const Platform* platform,
std::string* out, std::string* out,
Status* status); Status* status);
...@@ -432,12 +466,28 @@ std::unique_ptr<StreamingParserHandler> NewJSONEncoder(const Platform* platform, ...@@ -432,12 +466,28 @@ std::unique_ptr<StreamingParserHandler> NewJSONEncoder(const Platform* platform,
// json::ParseJSON - for receiving streaming parser events for JSON // json::ParseJSON - for receiving streaming parser events for JSON
// ============================================================================= // =============================================================================
void ParseJSON(const Platform* platform, void ParseJSON(const Platform& platform,
span<uint8_t> chars, span<uint8_t> chars,
StreamingParserHandler* handler); StreamingParserHandler* handler);
void ParseJSON(const Platform* platform, void ParseJSON(const Platform& platform,
span<uint16_t> chars, span<uint16_t> chars,
StreamingParserHandler* handler); StreamingParserHandler* handler);
// =============================================================================
// json::ConvertCBORToJSON, json::ConvertJSONToCBOR - for transcoding
// =============================================================================
Status ConvertCBORToJSON(const Platform& platform,
span<uint8_t> cbor,
std::string* json);
Status ConvertCBORToJSON(const Platform& platform,
span<uint8_t> cbor,
std::vector<uint8_t>* json);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json,
std::vector<uint8_t>* cbor);
Status ConvertJSONToCBOR(const Platform& platform,
span<uint8_t> json,
std::string* cbor);
} // namespace json } // namespace json
{% for namespace in config.protocol.namespace %} {% for namespace in config.protocol.namespace %}
......
File mode changed from 100644 to 100755
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