New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement document load tracking. #3714
Changes from 1 commit
File filter...
Jump to…
Make stylesheets block page load.
- Loading branch information
| @@ -8,7 +8,7 @@ | ||
| use script_task::{ScriptMsg, ScriptChan}; | ||
| use servo_msg::constellation_msg::{PipelineId}; | ||
| use servo_net::resource_task::{LoadResponse, Metadata, load_whole_resource, ResourceTask}; | ||
| use servo_net::resource_task::{ControlMsg, LoadData}; | ||
| use servo_net::resource_task::{LoadData, PendingAsyncLoad}; | ||
| use url::Url; | ||
|
|
||
| #[jstraceable] | ||
| @@ -57,17 +57,19 @@ impl DocumentLoader { | ||
| } | ||
| } | ||
|
|
||
| pub fn load_async(&mut self, load: LoadType) -> Receiver<LoadResponse> { | ||
| self.load_async_with(load, |_| {}) | ||
| pub fn load_async_with(&mut self, load: LoadType, cb: |load_data: &mut LoadData|) -> Receiver<LoadResponse> { | ||
| self.blocking_loads.push(load.clone()); | ||
| let pending = self.prep_async_load(load); | ||
| pending.load_with(cb) | ||
| } | ||
|
|
||
| pub fn load_async_with(&mut self, load: LoadType, cb: |load_data: &mut LoadData|) -> Receiver<LoadResponse> { | ||
| let (tx, rx) = channel(); | ||
| pub fn prep_async_load(&mut self, load: LoadType) -> PendingAsyncLoad { | ||
| self.blocking_loads.push(load.clone()); | ||
jdm
Author
Member
|
||
| let mut load_data = LoadData::new(load.url().clone(), tx); | ||
| cb(&mut load_data); | ||
| self.resource_task.send(ControlMsg::Load(load_data)); | ||
| rx | ||
| PendingAsyncLoad::new(self.resource_task.clone(), load.url().clone()) | ||
| } | ||
|
|
||
| pub fn load_async(&mut self, load: LoadType) -> Receiver<LoadResponse> { | ||
| self.load_async_with(load, |_| {}) | ||
| } | ||
|
|
||
| pub fn load_sync(&mut self, load: LoadType) -> Result<(Metadata, Vec<u8>), String> { | ||
What's the relationship of a
DocumentLoaderto the browsing context concept and the concept of a document? Why are blocking loads tracked on aDocumentLoaderobject and not on aDocumentobject? If the user navigates away from a document before theloadevent for the document has fired, what happens to theblocking_loadsvector on theDocumentLoader.