Urlmageddon: Use refcounted urls more often.

This commit is contained in:
Emilio Cobos Álvarez 2016-11-16 11:57:39 +01:00
parent f14e7339b5
commit 913c874cb5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
161 changed files with 1044 additions and 718 deletions

View file

@ -33,7 +33,7 @@ script_traits = {path = "../script_traits"}
serde = "0.8"
serde_derive = "0.8"
style_traits = {path = "../style_traits"}
url = {version = "1.2", features = ["heap_size"]}
servo_url = {path = "../url", features = ["servo"]}
util = {path = "../util"}
[dependencies.webrender_traits]

View file

@ -46,6 +46,7 @@ use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, Scri
use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg};
use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData};
use script_traits::{SWManagerMsg, ScopeThings, WindowSizeType};
use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::collections::{HashMap, VecDeque};
use std::io::Error as IOError;
@ -62,7 +63,6 @@ use style_traits::PagePx;
use style_traits::cursor::Cursor;
use style_traits::viewport::ViewportConstraints;
use timer_scheduler::TimerScheduler;
use url::Url;
use util::opts;
use util::prefs::PREFS;
use util::remutex::ReentrantMutex;
@ -1047,7 +1047,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
fn handle_register_serviceworker(&self, scope_things: ScopeThings, scope: Url) {
fn handle_register_serviceworker(&self, scope_things: ScopeThings, scope: ServoUrl) {
if let Some(ref mgr) = self.swmanager_chan {
let _ = mgr.send(ServiceWorkerMsg::RegisterServiceWorker(scope_things, scope));
} else {
@ -1055,7 +1055,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
fn handle_broadcast_storage_event(&self, pipeline_id: PipelineId, storage: StorageType, url: Url,
fn handle_broadcast_storage_event(&self, pipeline_id: PipelineId, storage: StorageType, url: ServoUrl,
key: Option<String>, old_value: Option<String>, new_value: Option<String>) {
let origin = url.origin();
for pipeline in self.pipelines.values() {
@ -1204,7 +1204,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.close_pipeline(pending_pipeline_id, ExitPipelineMode::Force);
}
let failure_url = Url::parse("about:failure").expect("infallible");
let failure_url = ServoUrl::parse("about:failure").expect("infallible");
if let Some(pipeline_url) = pipeline_url {
if pipeline_url == failure_url {
@ -1245,7 +1245,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
fn handle_init_load(&mut self, url: Url) {
fn handle_init_load(&mut self, url: ServoUrl) {
let window_size = self.window_size.visible_viewport;
let root_pipeline_id = PipelineId::new();
let root_frame_id = self.root_frame_id;
@ -1331,7 +1331,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
let load_data = load_info.load_data.unwrap_or_else(|| {
let url = match old_pipeline {
Some(old_pipeline) => old_pipeline.url.clone(),
None => Url::parse("about:blank").expect("infallible"),
None => ServoUrl::parse("about:blank").expect("infallible"),
};
// TODO - loaddata here should have referrer info (not None, None)

View file

@ -36,8 +36,8 @@ extern crate script_traits;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate servo_url;
extern crate style_traits;
extern crate url;
#[macro_use]
extern crate util;
extern crate webrender_traits;

View file

@ -26,6 +26,7 @@ use script_traits::{ConstellationControlMsg, InitialScriptState};
use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent};
use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData};
use servo_url::ServoUrl;
use std::collections::HashMap;
use std::env;
use std::ffi::OsStr;
@ -34,7 +35,6 @@ use std::process;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util::opts::{self, Opts};
use util::prefs::{PREFS, Pref};
use webrender_traits;
@ -58,7 +58,7 @@ pub struct Pipeline {
/// A channel to the compositor.
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
/// URL corresponding to the most recently-loaded page.
pub url: Url,
pub url: ServoUrl,
/// The title of the most recently-loaded page.
pub title: Option<String>,
pub size: Option<TypedSize2D<f32, PagePx>>,
@ -264,7 +264,7 @@ impl Pipeline {
layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>,
is_private: bool,
url: Url,
url: ServoUrl,
size: Option<TypedSize2D<f32, PagePx>>,
visible: bool)
-> Pipeline {