• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Feb-2021-

chromium/H16-Feb-2021-2916

README.mdH A D16-Feb-20214.6 KiB11581

cbor.ccH A D16-Feb-202137.4 KiB1,045789

cbor.hH A D16-Feb-202112.3 KiB309108

cbor_test.ccH A D16-Feb-202155.5 KiB1,3551,056

dispatch.ccH A D16-Feb-202119.3 KiB605504

dispatch.hH A D16-Feb-202111.7 KiB315163

dispatch_test.ccH A D16-Feb-202117.3 KiB446367

error_support.ccH A D16-Feb-20211.2 KiB6046

error_support.hH A D16-Feb-20212 KiB6330

error_support_test.ccH A D16-Feb-20211.3 KiB4633

export.hH A D16-Feb-2021684 3020

find_by_first.hH A D16-Feb-20212.2 KiB5936

find_by_first_test.ccH A D16-Feb-20212.5 KiB7763

frontend_channel.hH A D16-Feb-20212 KiB4822

json.ccH A D16-Feb-202130.2 KiB1,032852

json.hH A D16-Feb-20212.3 KiB5825

json_platform.hH A D16-Feb-2021822 2712

json_test.ccH A D16-Feb-202124.5 KiB730567

maybe.hH A D16-Feb-20212.4 KiB10581

maybe_test.ccH A D16-Feb-20211.4 KiB4530

parser_handler.hH A D16-Feb-20211.3 KiB4024

protocol_core.ccH A D16-Feb-20219.4 KiB290233

protocol_core.hH A D16-Feb-202113 KiB407327

protocol_core_test.ccH A D16-Feb-202116.9 KiB498374

serializable.ccH A D16-Feb-20211 KiB3722

serializable.hH A D16-Feb-20211 KiB3316

serializable_test.ccH A D16-Feb-20211.3 KiB4125

serializer_traits.hH A D16-Feb-20215.8 KiB159101

serializer_traits_test.ccH A D16-Feb-20217.3 KiB227148

span.ccH A D16-Feb-20211.1 KiB4028

span.hH A D16-Feb-20213.1 KiB10063

span_test.ccH A D16-Feb-20213.7 KiB11080

status.ccH A D16-Feb-20215 KiB127112

status.hH A D16-Feb-20214.3 KiB13999

status_test.ccH A D16-Feb-20211.1 KiB3019

status_test_support.ccH A D16-Feb-20211.4 KiB5137

status_test_support.hH A D16-Feb-20211 KiB3311

test_platform.ccH A D16-Feb-20211.1 KiB3421

test_platform.hH A D16-Feb-20211.2 KiB3214

transcode.ccH A D16-Feb-20211.8 KiB6254

README.md

1# CRDTP - Chrome DevTools Protocol Library.
2
3[Canonical location for this library.](https://chromium.googlesource.com/deps/inspector_protocol/+/refs/heads/master)
4
5This is a support library for the Chrome DevTools protocol implementation.
6
7It's used from within the Jinja templates which we use for code generation
8(see ../lib and ../templates) as well as from Chromium (headless,
9chrome, content, blink), V8, and other code bases that use the DevTools
10protocol.
11
12The library is designed to be portable. The only allowed dependencies are:
13
14- The C/C++ standard libraries, up to C++14.
15  The litmus test is that it compiles and passes tests for all platforms
16  supported by V8.
17
18- For testing, we depend on mini_chromium and gtest. This is isolated
19  into the `crdtp/test_platform.{h,cc}` library.
20
21We support 32 bit and 64 bit architectures.
22
23# Common types used in this library.
24
25- `uint8_t`: a byte, e.g. for raw bytes or UTF8 characters
26
27- `uint16_t`: two bytes, e.g. for UTF16 characters
28
29For input parameters:
30
31- `span<uint8_t>`: pointer to bytes and length
32
33- `span<uint16_t>`: pointer to UTF16 chars and length
34
35For output parameters:
36
37- `std::vector<uint8_t>` - Owned segment of bytes / utf8 characters and length.
38
39- `std::string` - Same, for compatibility, even though char is signed.
40
41# Building and running the tests.
42
43If you're familiar with
44[Chromium's development process](https://www.chromium.org/developers/contributing-code)
45and have the depot_tools installed, you may use these commands
46to fetch the package (and dependencies) and build and run the tests:
47
48    fetch inspector_protocol
49    cd src
50    gn gen out/Release
51    ninja -C out/Release crdtp_test
52    out/Release/crdtp_test
53
54You'll probably also need to install g++, since Clang uses this to find the
55standard C++ headers. E.g.,
56
57    sudo apt-get install g++-8
58
59# Purpose of the tests
60
61crdtp comes with unittest coverage.
62
63Upstream, in this standalone package, the unittests make development
64more pleasant because they are very fast and light (try the previous
65section to see).
66
67Downstream (in Chromium, V8, etc.), they ensure that the library behaves
68correctly within each specific code base. We have seen bugs from different
69architectures / compilers / etc. in the past. We have also seen
70that a tweaked downstream crdtp_platform library did not behave correctly,
71becaues V8's strtod routine interprets out of range literals as 'inf'.
72Thus, the unittests function as a conformance test suite for such code-base
73specific tweaks downstream.
74
75# Customization by downstream users (Chrome, V8, google3, etc.).
76
77Downstream users may need to customize the library. We isolate these typical
78customizations into two platform libraries (crdtp_plaform and
79crdtp_test_platform), to reduce the chance of merge conflicts and grief when
80rolling as much as possible. While customized platform libraries may
81depend on the downstream code base (e.g. abseil, Chromium's base, V8's utility
82functions, Boost, etc.), they are not exposed to the headers that
83downstream code depends on.
84
85## crdtp_platform
86
87This platform library is only used by the crdtp library; it is not part of the
88crdtp API. Thus far it consists only of json_platform.h and json_platform.cc,
89because conversion between a `std::string` and a double is tricky, and different
90code bases have different preferences in this regard. In this repository
91(upstream), json_platform.cc provides a reference implementation which uses the
92C++ standard library.
93
94Downstream, in Chromium, json_platform_chromium.cc has a different
95implementation that uses the routines in Chromium's //base, that is, it's a .cc
96file that's specific to Chromium. Similarly, in V8, json_platform_v8.cc uses
97V8's number conversion utilities, so it's a .cc file that's specific to V8. And
98in google3, we use the absl library. crdtp/json_platform.cc is designed to be
99easy to modify or replace, and the interface defined by its header is designed
100to be stable.
101
102## crdtp_test_platform
103
104This platform library is only used by the tests. Upstream, it's setup to
105use mini_chromium and gtest. Downstream, Chromium uses its //base libraries,
106and V8 uses theirs; and a small amount of tweaking is needed in each code
107base - e.g., Chromium, V8, and google3 each place `#include` declarations into
108test_platform.h that are specific to their code base, and they have their
109own routines in test_platform.cc which uses their own libraries.
110
111The purpose of crdtp_test_platform is to isolate the tweaking to this small,
112stable library (modifying test_platform.h and test_platform.cc). This avoids
113having to modify the actual tests (json_test.cc, cbor_test.cc, ...)
114when rolling changes downstream. We try to not use patch files.
115