diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-10-16 09:53:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-16 16:53:24 +0000 |
commit | 036e74524a72920ffca6deb4d6a850cf04b31736 (patch) | |
tree | 18c44ef55b2eb79c3899811cf3582363ad09f495 /components/net/tests/http_loader.rs | |
parent | 21152673282b7ac03cee5d97d46fe368b379a297 (diff) | |
download | servo-036e74524a72920ffca6deb4d6a850cf04b31736.tar.gz servo-036e74524a72920ffca6deb4d6a850cf04b31736.zip |
net: Start reducing number of IPCs channels used for fetch with a `FetchThread` (#33863)
Instead of creating a `ROUTER` for each fetch, create a fetch thread
which handles all incoming and outcoming fetch requests. Now messages
involving fetches carry a "request id" which indicates which fetch is
being addressed by the message. This greatly reduces the number of file
descriptors used by fetch.
In addition, the interface for kicking off fetches is simplified when
using the `Listener` with `Document`s and the `GlobalScope`.
This does not fix all leaked file descriptors / mach ports, but greatly
eliminates the number used. Now tests can be run without limiting
procesess on modern macOS systems.
Followup work:
1. There are more instances where fetch is done using the old method.
Some of these require more changes in order to be converted to the
`FetchThread` approach.
2. Eliminate usage of IPC channels when doing redirects.
3. Also eliminate the IPC channel used for cancel handling.
4. This change opens up the possiblity of controlling the priority of
fetch requests.
Fixes #29834.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/net/tests/http_loader.rs')
-rw-r--r-- | components/net/tests/http_loader.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index fac0101baba..bfa87f5df20 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -1426,12 +1426,12 @@ fn test_fetch_compressed_response_update_count() { impl FetchTaskTarget for FetchResponseCollector { fn process_request_body(&mut self, _: &Request) {} fn process_request_eof(&mut self, _: &Request) {} - fn process_response(&mut self, _: &Response) {} - fn process_response_chunk(&mut self, _: Vec<u8>) { + fn process_response(&mut self, _: &Request, _: &Response) {} + fn process_response_chunk(&mut self, _: &Request, _: Vec<u8>) { self.update_count += 1; } /// Fired when the response is fully fetched - fn process_response_eof(&mut self, _: &Response) { + fn process_response_eof(&mut self, _: &Request, _: &Response) { let _ = self.sender.send(self.update_count); } } |