| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8d509d8 commit b9510d2
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,6 +103,17 @@ def init_defaults(config_tuple, path, defaults): | |||
| 103 | 103 | ".lib": False, | |
| 104 | 104 | ".lib.export_macro": "", | |
| 105 | 105 | ".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": []}, | ||
| 106 | 117 | } | |
| 107 | 118 | for key_value in config_values: | |
| 108 | 119 | parts = key_value.split("=") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,10 @@ | |||
| 6 | 6 | ||
| 7 | 7 | //#include "Values.h" | |
| 8 | 8 | ||
| 9 | + {% if config.encoding_lib.header %} | ||
| 10 | + #include "{{config.encoding_lib.header}}" | ||
| 11 | + {% endif %} | ||
| 12 | + | ||
| 9 | 13 | {% for namespace in config.protocol.namespace %} | |
| 10 | 14 | namespace {{namespace}} { | |
| 11 | 15 | {% endfor %} | |
@@ -64,6 +68,30 @@ void escapeStringForJSONInternal(const Char* str, unsigned len, | |||
| 64 | 68 | // to this constant. | |
| 65 | 69 | static constexpr int kStackLimitValues = 1000; | |
| 66 | 70 | ||
| 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 | + | ||
| 67 | 95 | // Below are three parsing routines for CBOR, which cover enough | |
| 68 | 96 | // to roundtrip JSON messages. | |
| 69 | 97 | std::unique_ptr<DictionaryValue> parseMap(int32_t stack_depth, cbor::CBORTokenizer* tokenizer); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | // Use of this source code is governed by a BSD-style license that can be | |
| 6 | 6 | // found in the LICENSE file. | |
| 7 | 7 | ||
| 8 | + {% if config.encoding_lib.header == "" %} | ||
| 8 | 9 | ||
| 9 | 10 | #include <algorithm> | |
| 10 | 11 | #include <cassert> | |
@@ -2196,3 +2197,5 @@ Status ConvertJSONToCBOR(const Platform& platform, | |||
| 2196 | 2197 | {% for namespace in config.protocol.namespace %} | |
| 2197 | 2198 | } // namespace {{namespace}} | |
| 2198 | 2199 | {% endfor %} | |
| 2200 | + | ||
| 2201 | + {% endif %} | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | // Use of this source code is governed by a BSD-style license that can be | |
| 6 | 6 | // found in the LICENSE file. | |
| 7 | 7 | ||
| 8 | + {% if config.encoding_lib.header == "" %} | ||
| 8 | 9 | #ifndef {{"_".join(config.protocol.namespace)}}_encoding_h | |
| 9 | 10 | #define {{"_".join(config.protocol.namespace)}}_encoding_h | |
| 10 | 11 | ||
@@ -518,3 +519,4 @@ Status ConvertJSONToCBOR(const Platform& platform, | |||
| 518 | 519 | } // namespace {{namespace}} | |
| 519 | 520 | {% endfor %} | |
| 520 | 521 | #endif // !defined({{"_".join(config.protocol.namespace)}}_encoding_h) | |
| 522 | + {% endif %} | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments