mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Only store the url inside a pipeline instead of the rest of the LoadData.
This commit is contained in:
parent
e2c4f5ed67
commit
6351fc75fd
13 changed files with 34 additions and 27 deletions
|
@ -274,8 +274,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.change_page_title(pipeline_id, title);
|
||||
}
|
||||
|
||||
(Msg::ChangePageLoadData(frame_id, load_data), ShutdownState::NotShuttingDown) => {
|
||||
self.change_page_load_data(frame_id, load_data);
|
||||
(Msg::ChangePageUrl(frame_id, url), ShutdownState::NotShuttingDown) => {
|
||||
self.change_page_url(frame_id, url);
|
||||
}
|
||||
|
||||
(Msg::PaintMsgDiscarded, ShutdownState::NotShuttingDown) => {
|
||||
|
@ -441,8 +441,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn change_page_load_data(&mut self, _: FrameId, load_data: LoadData) {
|
||||
self.window.set_page_load_data(load_data);
|
||||
fn change_page_url(&mut self, _: FrameId, url: Url) {
|
||||
self.window.set_page_url(url);
|
||||
}
|
||||
|
||||
fn all_pipelines_in_idle_paint_state(&self) -> bool {
|
||||
|
|
|
@ -20,8 +20,9 @@ use layers::layers::LayerBufferSet;
|
|||
use pipeline::CompositionPipeline;
|
||||
use msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
|
||||
use msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
|
||||
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId};
|
||||
use msg::constellation_msg::{ConstellationChan, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::PagePx;
|
||||
use util::memory::MemoryProfilerChan;
|
||||
|
@ -200,8 +201,8 @@ pub enum Msg {
|
|||
ChangePaintState(PipelineId, PaintState),
|
||||
/// Alerts the compositor that the current page has changed its title.
|
||||
ChangePageTitle(PipelineId, Option<String>),
|
||||
/// Alerts the compositor that the current page has changed its load data (including URL).
|
||||
ChangePageLoadData(FrameId, LoadData),
|
||||
/// Alerts the compositor that the current page has changed its URL.
|
||||
ChangePageUrl(FrameId, Url),
|
||||
/// Alerts the compositor that a `PaintMsg` has been discarded.
|
||||
PaintMsgDiscarded,
|
||||
/// Replaces the current frame tree, typically called during main frame navigation.
|
||||
|
@ -237,7 +238,7 @@ impl Debug for Msg {
|
|||
Msg::ChangeReadyState(..) => write!(f, "ChangeReadyState"),
|
||||
Msg::ChangePaintState(..) => write!(f, "ChangePaintState"),
|
||||
Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"),
|
||||
Msg::ChangePageLoadData(..) => write!(f, "ChangePageLoadData"),
|
||||
Msg::ChangePageUrl(..) => write!(f, "ChangePageUrl"),
|
||||
Msg::PaintMsgDiscarded(..) => write!(f, "PaintMsgDiscarded"),
|
||||
Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
|
||||
Msg::CreateRootLayerForPipeline(..) => write!(f, "CreateRootLayerForPipeline"),
|
||||
|
|
|
@ -334,9 +334,9 @@ impl NavigationContext {
|
|||
/// compositor of the new URLs.
|
||||
fn set_current(&mut self, new_frame: Rc<FrameTree>, compositor_proxy: &mut CompositorProxy) {
|
||||
self.current = Some(new_frame.clone());
|
||||
compositor_proxy.send(CompositorMsg::ChangePageLoadData(
|
||||
compositor_proxy.send(CompositorMsg::ChangePageUrl(
|
||||
new_frame.id,
|
||||
new_frame.pipeline.borrow().load_data.clone()));
|
||||
new_frame.pipeline.borrow().url.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
source Id of ScriptLoadedURLInIFrameMsg does have an associated pipeline in
|
||||
constellation. This should be impossible.").clone();
|
||||
|
||||
let source_url = source_pipeline.load_data.url.clone();
|
||||
let source_url = source_pipeline.url.clone();
|
||||
|
||||
let same_script = (source_url.host() == url.host() &&
|
||||
source_url.port() == url.port()) &&
|
||||
|
|
|
@ -113,7 +113,7 @@ impl CompositorEventListener for NullCompositor {
|
|||
Msg::PaintMsgDiscarded(..) |
|
||||
Msg::ScrollTimeout(..) |
|
||||
Msg::ChangePageTitle(..) |
|
||||
Msg::ChangePageLoadData(..) |
|
||||
Msg::ChangePageUrl(..) |
|
||||
Msg::KeyEvent(..) |
|
||||
Msg::SetCursor(..) => {}
|
||||
Msg::PaintTaskExited(..) => {}
|
||||
|
|
|
@ -16,6 +16,7 @@ use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
|
|||
use net::image_cache_task::ImageCacheTask;
|
||||
use net::resource_task::ResourceTask;
|
||||
use net::storage_task::StorageTask;
|
||||
use url::Url;
|
||||
use util::time::TimeProfilerChan;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Receiver, channel};
|
||||
|
@ -29,8 +30,8 @@ pub struct Pipeline {
|
|||
pub paint_chan: PaintChan,
|
||||
pub layout_shutdown_port: Receiver<()>,
|
||||
pub paint_shutdown_port: Receiver<()>,
|
||||
/// Load data corresponding to the most recently-loaded page.
|
||||
pub load_data: LoadData,
|
||||
/// URL corresponding to the most recently-loaded page.
|
||||
pub url: Url,
|
||||
/// The title of the most recently-loaded page.
|
||||
pub title: Option<String>,
|
||||
}
|
||||
|
@ -137,7 +138,7 @@ impl Pipeline {
|
|||
paint_chan,
|
||||
layout_shutdown_port,
|
||||
paint_shutdown_port,
|
||||
load_data)
|
||||
load_data.url)
|
||||
}
|
||||
|
||||
pub fn new(id: PipelineId,
|
||||
|
@ -147,7 +148,7 @@ impl Pipeline {
|
|||
paint_chan: PaintChan,
|
||||
layout_shutdown_port: Receiver<()>,
|
||||
paint_shutdown_port: Receiver<()>,
|
||||
load_data: LoadData)
|
||||
url: Url)
|
||||
-> Pipeline {
|
||||
Pipeline {
|
||||
id: id,
|
||||
|
@ -157,7 +158,7 @@ impl Pipeline {
|
|||
paint_chan: paint_chan,
|
||||
layout_shutdown_port: layout_shutdown_port,
|
||||
paint_shutdown_port: paint_shutdown_port,
|
||||
load_data: load_data,
|
||||
url: url,
|
||||
title: None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ use geom::size::TypedSize2D;
|
|||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeGraphicsMetadata;
|
||||
use msg::compositor_msg::{PaintState, ReadyState};
|
||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
|
||||
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::ScreenPx;
|
||||
use std::fmt::{Error, Formatter, Debug};
|
||||
|
@ -105,7 +106,7 @@ pub trait WindowMethods {
|
|||
/// Sets the page title for the current page.
|
||||
fn set_page_title(&self, title: Option<String>);
|
||||
/// Sets the load data for the current page.
|
||||
fn set_page_load_data(&self, load_data: LoadData);
|
||||
fn set_page_url(&self, url: Url);
|
||||
/// Called when the browser is done loading a frame.
|
||||
fn load_end(&self);
|
||||
|
||||
|
|
1
components/servo/Cargo.lock
generated
1
components/servo/Cargo.lock
generated
|
@ -389,6 +389,7 @@ dependencies = [
|
|||
"libc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"time 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
|
1
ports/cef/Cargo.lock
generated
1
ports/cef/Cargo.lock
generated
|
@ -392,6 +392,7 @@ dependencies = [
|
|||
"libc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"time 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ use layers::platform::surface::NativeGraphicsMetadata;
|
|||
use libc::{c_char, c_void};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use msg::compositor_msg::{ReadyState, PaintState};
|
||||
use msg::constellation_msg::LoadData;
|
||||
use std_url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::ScreenPx;
|
||||
use std::cell::RefCell;
|
||||
|
@ -286,7 +286,7 @@ impl WindowMethods for Window {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_page_load_data(&self, load_data: LoadData) {
|
||||
fn set_page_url(&self, url: Url) {
|
||||
let browser = self.cef_browser.borrow();
|
||||
let browser = match *browser {
|
||||
None => return,
|
||||
|
@ -294,7 +294,7 @@ impl WindowMethods for Window {
|
|||
};
|
||||
let frame = browser.get_main_frame();
|
||||
let frame = frame.downcast();
|
||||
*frame.url.borrow_mut() = load_data.url.to_string()
|
||||
*frame.url.borrow_mut() = url.to_string()
|
||||
}
|
||||
|
||||
fn handle_key(&self, _: Key, _: KeyModifiers) {
|
||||
|
|
|
@ -43,3 +43,4 @@ git = "https://github.com/servo/rust-egl"
|
|||
time = "0.1.12"
|
||||
bitflags = "*"
|
||||
libc = "*"
|
||||
url = "*"
|
|
@ -22,6 +22,7 @@ extern crate msg;
|
|||
extern crate time;
|
||||
extern crate util;
|
||||
extern crate egl;
|
||||
extern crate url;
|
||||
|
||||
use compositing::windowing::WindowEvent;
|
||||
use geom::scale_factor::ScaleFactor;
|
||||
|
|
|
@ -15,10 +15,10 @@ use layers::platform::surface::NativeGraphicsMetadata;
|
|||
use msg::constellation_msg;
|
||||
use msg::constellation_msg::Key;
|
||||
use msg::compositor_msg::{PaintState, ReadyState};
|
||||
use msg::constellation_msg::LoadData;
|
||||
use NestedEventLoopListener;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::ScreenPx;
|
||||
|
||||
|
@ -462,7 +462,7 @@ impl WindowMethods for Window {
|
|||
self.window.set_title(&title);
|
||||
}
|
||||
|
||||
fn set_page_load_data(&self, _: LoadData) {
|
||||
fn set_page_url(&self, _: Url) {
|
||||
}
|
||||
|
||||
fn load_end(&self) {
|
||||
|
@ -657,7 +657,7 @@ impl WindowMethods for Window {
|
|||
fn set_page_title(&self, _: Option<String>) {
|
||||
}
|
||||
|
||||
fn set_page_load_data(&self, _: LoadData) {
|
||||
fn set_page_url(&self, _: Url) {
|
||||
}
|
||||
|
||||
fn load_end(&self) {
|
||||
|
|
|
@ -13,7 +13,6 @@ use layers::platform::surface::NativeGraphicsMetadata;
|
|||
use libc::c_int;
|
||||
use msg::compositor_msg::{ReadyState, PaintState};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use msg::constellation_msg::LoadData;
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::rc::Rc;
|
||||
|
@ -22,6 +21,7 @@ use std::mem::size_of;
|
|||
use std::mem::zeroed;
|
||||
use std::ptr;
|
||||
use std::ffi::CString;
|
||||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::ScreenPx;
|
||||
use gleam::gl;
|
||||
|
@ -804,7 +804,7 @@ impl WindowMethods for Window {
|
|||
fn set_page_title(&self, _: Option<String>) {
|
||||
}
|
||||
|
||||
fn set_page_load_data(&self, _: LoadData) {
|
||||
fn set_page_url(&self, _: Url) {
|
||||
}
|
||||
|
||||
fn load_end(&self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue