Commit 27ba9e0
[protocol] Introduce CDPConnection interface
This CL proposes to introduce a new abstraction layer that will allow
us to utilize puppeteer connections in DevTools. At the moment we
have 2 layers:
1) Raw transport: Sending and receiving strings.
Current implementation: ConnectionTransport
2) Message and session handling: Parsing strings into messages,
correlating requests with their responses and dispatching
them on the right session.
Current implementation: SessionRouter
The new CDPConnection would be introduced inbetween: It uses
an existing transport and would only handle messages. That is,
serialization/deserializatrion and matching requests with their
responses.
A follow-up CL will add a concerete DevTools implementation that
moves the existing pieces out of SessionRouter.
As part of this refactoring, we also introduce an 'inspectable'
version of the connection: The protocol monitor and our test
harnesses require raw inspection of the CDP traffic. At the
moment, these are global functions ona global `test` object
that everyone can install, with the downside they can
overwrite each other. The proposed 'RawMessageObserver'
can handle both `test.dumpProtocol` as well as
`test.onMessageSent` and `test.onMessageReceived`.
Note: We use an observer pattern rather then the DevTools
event system for performance reasons: CDP is generally
rather talkative. Using an `ObjectWrapper` with an
`CDP_EVENT_RECEIVED` event would mean we have to do a Map
lookup to get the list of listeners for each CDP event.
With an observer, we can at least avoid the map lookup.
[email protected], [email protected]
Bug: 453469270
Change-Id: Ia226c2137274a73752b586e1fc924f6b91413f6a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7075672
Reviewed-by: Alex Rudenko <[email protected]>
Commit-Queue: Simon Zünd <[email protected]>
Reviewed-by: Philip Pfaffe <[email protected]>1 parent 28778f6 commit 27ba9e0
File tree
3 files changed
+41
-0
lines changed- config/gni
- front_end/core/protocol_client
3 files changed
+41
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
898 | 899 | | |
899 | 900 | | |
900 | 901 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments