mirror of
https://github.com/servo/servo
synced 2026-05-11 17:37:21 +02:00
#41857 exposed some more code in the net crate that performed blocking communication with the embedder and could prevent other networking tasks from running. To address that, we need the net code to perform async receive operations, which requires passing tokio channels to the embedder. However, the current embedding message design puts all messages in the same enum and requires that they are serializable. Embedder messages from the network do not require this property, since they run in the same process as the embedder. Therefore, this PR creates a new EmbedderProxy structure that is generic over the message, allowing each component of Servo to use a embedder message type that is specific to that component. The final benefit of this set of changes is that the embedder messages for a particular crate can now live in the crate itself (since the only crate that depends on it is the servo crate), not in the shared `embedding_traits` crate. This hugely reduces the amount of code that needs to be rebuilt when changing these messages, enabling much faster incremental builds for those changes. Testing: Strictly refactoring; existing test coverage is sufficient. Fixes: #41958 --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>