Name Description Size
Viaduct.cpp 1213
Viaduct.h Viaduct is a way for Application Services Rust components ( to make network requests using a trusted stack (gecko). The way it works is roughly as follows: - First we register a callback using `viaduct_initialize` (Viaduct::Initialize). This callback is stored on the Rust side in a static variable, therefore Initialize() must be called only once. - When the Rust code needs to make a network request, our callback (Viaduct::ViaductCallback) will be called with a protocol buffer describing the request to make on their behalf. Note 1: The callback MUST be called from a background thread as it is blocking. Note 2: It is our side responsibility to call `viaduct_destroy_bytebuffer` on the buffer. - We set a semaphore to make the background thread wait while we make the request on the main thread using nsIChannel. (ViaductRequest::MakeRequest) - Once a response is received, we allocate a bytebuffer to store the response using `viaduct_alloc_bytebuffer` and unlock the semaphore. (ViaductRequest::OnStopRequest) - The background thread is unlocked, and the callback returns the response to the Rust caller. (Viaduct::ViaductCallback) - The Rust caller will free the response buffer we allocated earlier. Reference: 2348
ViaductRequest.cpp merge 9864
ViaductRequest.h 1445
components.conf 505 42152
fetch_msg_types.pb.h 49791
fetch_msg_types.proto 1036 681
mozIViaduct.idl 373