Skip to content

Commit 26a067e

Browse files
Trotttargos
authored andcommitted
tools: update inspector_protocol to e8ba1a7
Refs: https://chromium.googlesource.com/deps/inspector_protocol/+log PR-URL: #39694 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9847d58 commit 26a067e

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

Diff for: tools/inspector_protocol/code_generator.py

+11
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ def init_defaults(config_tuple, path, defaults):
103103
".lib": False,
104104
".lib.export_macro": "",
105105
".lib.export_header": False,
106+
# The encoding lib consists of encoding/encoding.h and
107+
# encoding/encoding.cc in its subdirectory, which binaries
108+
# may link / depend on, instead of relying on the
109+
# JINJA2 templates lib/encoding_{h,cc}.template.
110+
# In that case, |header| identifies the include file
111+
# and |namespace| is the namespace it's using. Usually
112+
# inspector_protocol_encoding but for v8's copy it's
113+
# v8_inspector_protocol_encoding.
114+
# TODO(johannes): Migrate away from lib/encoding_{h,cc}.template
115+
# in favor of this.
116+
".encoding_lib": { "header": "", "namespace": []},
106117
}
107118
for key_value in config_values:
108119
parts = key_value.split("=")

Diff for: tools/inspector_protocol/lib/Values_cpp.template

+28
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
//#include "Values.h"
88

9+
{% if config.encoding_lib.header %}
10+
#include "{{config.encoding_lib.header}}"
11+
{% endif %}
12+
913
{% for namespace in config.protocol.namespace %}
1014
namespace {{namespace}} {
1115
{% endfor %}
@@ -64,6 +68,30 @@ void escapeStringForJSONInternal(const Char* str, unsigned len,
6468
// to this constant.
6569
static constexpr int kStackLimitValues = 1000;
6670

71+
{% if config.encoding_lib.namespace %}
72+
using {{"::".join(config.encoding_lib.namespace)}}::Error;
73+
using {{"::".join(config.encoding_lib.namespace)}}::Status;
74+
using {{"::".join(config.encoding_lib.namespace)}}::span;
75+
namespace cbor {
76+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::CBORTokenTag;
77+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::CBORTokenizer;
78+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeBinary;
79+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeDouble;
80+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeFalse;
81+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeFromLatin1;
82+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeFromUTF16;
83+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeIndefiniteLengthArrayStart;
84+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeIndefiniteLengthMapStart;
85+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeInt32;
86+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeNull;
87+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeStop;
88+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeString8;
89+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EncodeTrue;
90+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::EnvelopeEncoder;
91+
using {{"::".join(config.encoding_lib.namespace + ['cbor'])}}::InitialByteForEnvelope;
92+
} // namespace cbor
93+
{% endif %}
94+
6795
// Below are three parsing routines for CBOR, which cover enough
6896
// to roundtrip JSON messages.
6997
std::unique_ptr<DictionaryValue> parseMap(int32_t stack_depth, cbor::CBORTokenizer* tokenizer);

Diff for: tools/inspector_protocol/lib/encoding_cpp.template

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Use of this source code is governed by a BSD-style license that can be
66
// found in the LICENSE file.
77

8+
{% if config.encoding_lib.header == "" %}
89

910
#include <algorithm>
1011
#include <cassert>
@@ -2196,3 +2197,5 @@ Status ConvertJSONToCBOR(const Platform& platform,
21962197
{% for namespace in config.protocol.namespace %}
21972198
} // namespace {{namespace}}
21982199
{% endfor %}
2200+
2201+
{% endif %}

Diff for: tools/inspector_protocol/lib/encoding_h.template

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Use of this source code is governed by a BSD-style license that can be
66
// found in the LICENSE file.
77

8+
{% if config.encoding_lib.header == "" %}
89
#ifndef {{"_".join(config.protocol.namespace)}}_encoding_h
910
#define {{"_".join(config.protocol.namespace)}}_encoding_h
1011

@@ -518,3 +519,4 @@ Status ConvertJSONToCBOR(const Platform& platform,
518519
} // namespace {{namespace}}
519520
{% endfor %}
520521
#endif // !defined({{"_".join(config.protocol.namespace)}}_encoding_h)
522+
{% endif %}

0 commit comments

Comments
 (0)