net: Make most of the resource task messages serializable.

This commit is contained in:
Patrick Walton 2015-07-09 16:18:38 -07:00
parent 7e77285745
commit 9c9d7dc93b
15 changed files with 373 additions and 105 deletions

View file

@ -67,8 +67,10 @@ use msg::constellation_msg::{LoadData, PipelineId, SubpageId, MozBrowserEvent, W
use msg::constellation_msg::{Failure, WindowSizeData, PipelineExitType};
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::{ResourceTask, LoadConsumer, ControlMsg, Metadata};
use net_traits::LoadData as NetLoadData;
use net_traits::{ResourceTask, LoadConsumer, ControlMsg, Metadata};
use net_traits::{SerializableContentType, SerializableHeaders, SerializableMethod};
use net_traits::{SerializableUrl};
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageCacheResult};
use net_traits::storage_task::StorageTask;
use profile_traits::mem::{self, Report, Reporter, ReporterRequest, ReportKind, ReportsChan};
@ -1309,7 +1311,7 @@ impl ScriptTask {
/// The entry point to document loading. Defines bindings, sets up the window and document
/// objects, parses HTML and CSS, and kicks off initial layout.
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> Root<ServoHTMLParser> {
let final_url = metadata.final_url.clone();
let final_url = (*metadata.final_url).clone();
debug!("ScriptTask: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
// We should either be initializing a root page or loading a child page of an
@ -1415,7 +1417,11 @@ impl ScriptTask {
});
let content_type = match metadata.content_type {
Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => Some("text/plain".to_owned()),
Some(SerializableContentType(ContentType(Mime(TopLevel::Text,
SubLevel::Plain,
_)))) => {
Some("text/plain".to_owned())
}
_ => None
};
@ -1690,10 +1696,10 @@ impl ScriptTask {
}
resource_task.send(ControlMsg::Load(NetLoadData {
url: load_data.url,
method: load_data.method,
headers: Headers::new(),
preserved_headers: load_data.headers,
url: SerializableUrl(load_data.url),
method: SerializableMethod(load_data.method),
headers: SerializableHeaders(Headers::new()),
preserved_headers: SerializableHeaders(load_data.headers),
data: load_data.data,
cors: None,
pipeline_id: Some(id),