Commit 99feae23 authored by Johannes Henkel's avatar Johannes Henkel Committed by Commit Bot

[DevTools] Roll inspector protocol for V8

New revision: 0aafd2876f7485db7b07c513c0457b7cbbbe3304

https://chromium.googlesource.com/deps/inspector_protocol/+/0aafd2876f7485db7b07c513c0457b7cbbbe3304

Change-Id: I6e9babc8401a5af3085cce81b963f288d0392c07
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1613478Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Commit-Queue: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61620}
parent 2ebff719
......@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0
Revision: 50a14c3884caf012f3a5fc666d5eb8033d8a184a
Revision: 0aafd2876f7485db7b07c513c0457b7cbbbe3304
License: BSD
License File: LICENSE
Security Critical: no
......
......@@ -8,6 +8,7 @@
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <memory>
#include <string>
#include <vector>
......@@ -18,13 +19,11 @@ namespace v8_inspector_protocol_encoding {
// span - sequence of bytes
// =============================================================================
// This template is similar to std::span, which will be included in C++20. Like
// std::span it uses ptrdiff_t, which is signed (and thus a bit annoying
// sometimes when comparing with size_t), but other than this it's much simpler.
// This template is similar to std::span, which will be included in C++20.
template <typename T>
class span {
public:
using index_type = std::ptrdiff_t;
using index_type = size_t;
span() : data_(nullptr), size_(0) {}
span(const T* data, index_type size) : data_(data), size_(size) {}
......@@ -116,13 +115,13 @@ enum class Error {
// A status value with position that can be copied. The default status
// is OK. Usually, error status values should come with a valid position.
struct Status {
static constexpr std::ptrdiff_t npos() { return -1; }
static constexpr size_t npos() { return std::numeric_limits<size_t>::max(); }
bool ok() const { return error == Error::OK; }
Error error = Error::OK;
std::ptrdiff_t pos = npos();
Status(Error error, std::ptrdiff_t pos) : error(error), pos(pos) {}
size_t pos = npos();
Status(Error error, size_t pos) : error(error), pos(pos) {}
Status() = default;
// Returns a 7 bit US-ASCII string, either "OK" or an error message
......@@ -268,7 +267,7 @@ class EnvelopeEncoder {
bool EncodeStop(std::string* out);
private:
std::size_t byte_size_pos_ = 0;
size_t byte_size_pos_ = 0;
};
// =============================================================================
......@@ -392,13 +391,13 @@ class CBORTokenizer {
private:
void ReadNextToken(bool enter_envelope);
void SetToken(CBORTokenTag token, std::ptrdiff_t token_byte_length);
void SetToken(CBORTokenTag token, size_t token_byte_length);
void SetError(Error error);
span<uint8_t> bytes_;
CBORTokenTag token_tag_;
struct Status status_;
std::ptrdiff_t token_byte_length_;
size_t token_byte_length_;
MajorType token_start_type_;
uint64_t token_start_internal_value_;
};
......
......@@ -137,7 +137,7 @@ std::unique_ptr<Value> parseValue(
}
case cbor::CBORTokenTag::STRING16: {
span<uint8_t> wire = tokenizer->GetString16WireRep();
DCHECK_EQ(wire.size() & 1, 0);
DCHECK_EQ(wire.size() & 1, 0u);
std::unique_ptr<Value> value = StringValue::create(StringUtil::fromUTF16(
reinterpret_cast<const uint16_t*>(wire.data()), wire.size() / 2));
tokenizer->Next();
......
......@@ -11,6 +11,7 @@
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <memory>
#include <string>
#include <vector>
......@@ -26,13 +27,11 @@ namespace {{namespace}} {
// span - sequence of bytes
// =============================================================================
// This template is similar to std::span, which will be included in C++20. Like
// std::span it uses ptrdiff_t, which is signed (and thus a bit annoying
// sometimes when comparing with size_t), but other than this it's much simpler.
// This template is similar to std::span, which will be included in C++20.
template <typename T>
class span {
public:
using index_type = std::ptrdiff_t;
using index_type = size_t;
span() : data_(nullptr), size_(0) {}
span(const T* data, index_type size) : data_(data), size_(size) {}
......@@ -124,13 +123,13 @@ enum class Error {
// A status value with position that can be copied. The default status
// is OK. Usually, error status values should come with a valid position.
struct Status {
static constexpr std::ptrdiff_t npos() { return -1; }
static constexpr size_t npos() { return std::numeric_limits<size_t>::max(); }
bool ok() const { return error == Error::OK; }
Error error = Error::OK;
std::ptrdiff_t pos = npos();
Status(Error error, std::ptrdiff_t pos) : error(error), pos(pos) {}
size_t pos = npos();
Status(Error error, size_t pos) : error(error), pos(pos) {}
Status() = default;
// Returns a 7 bit US-ASCII string, either "OK" or an error message
......@@ -276,7 +275,7 @@ class EnvelopeEncoder {
bool EncodeStop(std::string* out);
private:
std::size_t byte_size_pos_ = 0;
size_t byte_size_pos_ = 0;
};
// =============================================================================
......@@ -400,13 +399,13 @@ class CBORTokenizer {
private:
void ReadNextToken(bool enter_envelope);
void SetToken(CBORTokenTag token, std::ptrdiff_t token_byte_length);
void SetToken(CBORTokenTag token, size_t token_byte_length);
void SetError(Error error);
span<uint8_t> bytes_;
CBORTokenTag token_tag_;
struct Status status_;
std::ptrdiff_t token_byte_length_;
size_t token_byte_length_;
MajorType token_start_type_;
uint64_t token_start_internal_value_;
};
......
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