Prefetch img and scripts during parsing

This commit is contained in:
Alan Jeffrey 2019-09-05 11:57:21 -05:00
parent 5bcb1b579c
commit 1aeb97b281
8 changed files with 351 additions and 45 deletions

View file

@ -237,6 +237,18 @@ impl FetchTaskTarget for IpcSender<FetchResponseMsg> {
}
}
impl FetchTaskTarget for () {
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_eof(&mut self, _: &Response) {}
}
pub trait Action<Listener> {
fn process(self, listener: &mut Listener);
}
@ -368,6 +380,9 @@ pub enum FetchChannels {
event_sender: IpcSender<WebSocketNetworkEvent>,
action_receiver: IpcReceiver<WebSocketDomAction>,
},
/// If the fetch is just being done to populate the cache,
/// not because the data is needed now.
Prefetch,
}
#[derive(Debug, Deserialize, Serialize)]