mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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>
This commit is contained in:
parent
2115267328
commit
036e74524a
31 changed files with 761 additions and 766 deletions
|
@ -17,7 +17,7 @@ use net_traits::fetch::headers::is_forbidden_method;
|
|||
use net_traits::request::{
|
||||
CacheMode as NetTraitsRequestCache, CredentialsMode as NetTraitsRequestCredentials,
|
||||
Destination as NetTraitsRequestDestination, Origin, RedirectMode as NetTraitsRequestRedirect,
|
||||
Referrer as NetTraitsRequestReferrer, Request as NetTraitsRequest,
|
||||
Referrer as NetTraitsRequestReferrer, Request as NetTraitsRequest, RequestBuilder,
|
||||
RequestMode as NetTraitsRequestMode, Window,
|
||||
};
|
||||
use net_traits::ReferrerPolicy as MsgReferrerPolicy;
|
||||
|
@ -107,11 +107,11 @@ impl Request {
|
|||
}
|
||||
|
||||
fn net_request_from_global(global: &GlobalScope, url: ServoUrl) -> NetTraitsRequest {
|
||||
let origin = Origin::Origin(global.get_url().origin());
|
||||
let https_state = global.get_https_state();
|
||||
let pipeline_id = global.pipeline_id();
|
||||
let referrer = global.get_referrer();
|
||||
NetTraitsRequest::new(url, Some(origin), referrer, Some(pipeline_id), https_state)
|
||||
RequestBuilder::new(url, global.get_referrer())
|
||||
.origin(global.get_url().origin())
|
||||
.pipeline_id(Some(global.pipeline_id()))
|
||||
.https_state(global.get_https_state())
|
||||
.build()
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-method-normalize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue