mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Move LoadData to script_traits.
This commit is contained in:
parent
bb271ef4af
commit
e97f06800e
16 changed files with 67 additions and 66 deletions
|
@ -19,14 +19,14 @@ use image::{DynamicImage, ImageFormat, RgbImage};
|
|||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{LoadData, TraversalDirection, PipelineId};
|
||||
use msg::constellation_msg::{PipelineIndex, PipelineNamespaceId, WindowSizeType};
|
||||
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
|
||||
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
||||
use profile_traits::mem::{self, Reporter, ReporterRequest};
|
||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
||||
use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton, MouseEventType};
|
||||
use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType};
|
||||
use script_traits::{TouchId, WindowSizeData};
|
||||
use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton};
|
||||
use script_traits::{MouseEventType, StackingContextScrollState};
|
||||
use script_traits::{TouchpadPressurePhase, TouchEventType, TouchId, WindowSizeData};
|
||||
use script_traits::CompositorEvent::{self, MouseMoveEvent, MouseButtonEvent, TouchEvent, TouchpadPressureEvent};
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
|
|
|
@ -26,7 +26,7 @@ use ipc_channel::router::ROUTER;
|
|||
use layout_traits::LayoutThreadFactory;
|
||||
use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord};
|
||||
use msg::constellation_msg::{FrameId, FrameType, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
|
||||
use msg::constellation_msg::WindowSizeType;
|
||||
use net_traits::{self, IpcSend, ResourceThreads};
|
||||
|
@ -40,7 +40,7 @@ use profile_traits::time;
|
|||
use rand::{Rng, SeedableRng, StdRng, random};
|
||||
use script_traits::{AnimationState, AnimationTickType, CompositorEvent};
|
||||
use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg};
|
||||
use script_traits::{DocumentState, LayoutControlMsg};
|
||||
use script_traits::{DocumentState, LayoutControlMsg, LoadData};
|
||||
use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest};
|
||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
||||
use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg};
|
||||
|
|
|
@ -15,14 +15,15 @@ use gfx_traits::DevicePixel;
|
|||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_traits::LayoutThreadFactory;
|
||||
use msg::constellation_msg::{FrameId, FrameType, LoadData, PipelineId, PipelineNamespaceId};
|
||||
use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespaceId};
|
||||
use net_traits::{IpcSend, ResourceThreads};
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use profile_traits::mem as profile_mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent};
|
||||
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg};
|
||||
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 std::collections::HashMap;
|
||||
use std::env;
|
||||
|
|
|
@ -14,13 +14,10 @@ bitflags = "0.7"
|
|||
cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
hyper = "0.9.9"
|
||||
hyper_serde = "0.1.4"
|
||||
ipc-channel = "0.5"
|
||||
plugins = {path = "../plugins"}
|
||||
serde = "0.8"
|
||||
serde_derive = "0.8"
|
||||
url = {version = "1.2", features = ["heap_size", "serde"]}
|
||||
|
||||
[dependencies.webrender_traits]
|
||||
git = "https://github.com/servo/webrender"
|
||||
|
|
|
@ -5,12 +5,9 @@
|
|||
//! The high-level interface from script to constellation. Using this abstract interface helps
|
||||
//! reduce coupling between these two components.
|
||||
|
||||
use hyper::header::Headers;
|
||||
use hyper::method::Method;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use url::Url;
|
||||
use webrender_traits;
|
||||
|
||||
#[derive(Deserialize, Eq, PartialEq, Serialize, Copy, Clone, HeapSizeOf)]
|
||||
|
@ -185,36 +182,6 @@ pub struct Image {
|
|||
pub id: Option<webrender_traits::ImageKey>,
|
||||
}
|
||||
|
||||
/// Similar to net::resource_thread::LoadData
|
||||
/// can be passed to LoadUrl to load a page with GET/POST
|
||||
/// parameters or headers
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct LoadData {
|
||||
pub url: Url,
|
||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||
serialize_with = "::hyper_serde::serialize")]
|
||||
pub method: Method,
|
||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||
serialize_with = "::hyper_serde::serialize")]
|
||||
pub headers: Headers,
|
||||
pub data: Option<Vec<u8>>,
|
||||
pub referrer_policy: Option<ReferrerPolicy>,
|
||||
pub referrer_url: Option<Url>,
|
||||
}
|
||||
|
||||
impl LoadData {
|
||||
pub fn new(url: Url, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<Url>) -> LoadData {
|
||||
LoadData {
|
||||
url: url,
|
||||
method: Method::Get,
|
||||
headers: Headers::new(),
|
||||
data: None,
|
||||
referrer_policy: referrer_policy,
|
||||
referrer_url: referrer_url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
|
||||
pub enum TraversalDirection {
|
||||
Forward(usize),
|
||||
|
|
|
@ -11,13 +11,10 @@
|
|||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate heapsize;
|
||||
extern crate hyper;
|
||||
extern crate hyper_serde;
|
||||
extern crate ipc_channel;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate url;
|
||||
extern crate webrender_traits;
|
||||
|
||||
pub mod constellation_msg;
|
||||
|
|
|
@ -42,9 +42,10 @@ use encoding::all::UTF_8;
|
|||
use encoding::label::encoding_from_whatwg_label;
|
||||
use hyper::header::{Charset, ContentDisposition, ContentType, DispositionParam, DispositionType};
|
||||
use hyper::method::Method;
|
||||
use msg::constellation_msg::{LoadData, PipelineId};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use rand::random;
|
||||
use script_thread::{MainThreadScriptMsg, Runnable};
|
||||
use script_traits::LoadData;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
|
|
@ -38,10 +38,10 @@ use dom::window::{ReflowReason, Window};
|
|||
use ipc_channel::ipc;
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
|
||||
use js::jsval::{NullValue, UndefinedValue};
|
||||
use msg::constellation_msg::{FrameType, FrameId, LoadData, PipelineId, TraversalDirection};
|
||||
use msg::constellation_msg::{FrameType, FrameId, PipelineId, TraversalDirection};
|
||||
use net_traits::response::HttpsState;
|
||||
use script_layout_interface::message::ReflowQueryType;
|
||||
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::{IFrameLoadInfo, LoadData, MozBrowserEvent, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use std::cell::Cell;
|
||||
use string_cache::Atom;
|
||||
|
|
|
@ -49,7 +49,7 @@ use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
|
|||
use js::jsapi::{JS_GC, JS_GetRuntime, SetWindowProxy};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
use msg::constellation_msg::{FrameType, LoadData, PipelineId, ReferrerPolicy, WindowSizeType};
|
||||
use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, WindowSizeType};
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
|
||||
|
@ -68,7 +68,7 @@ use script_layout_interface::rpc::{MarginStyleResponse, ResolvedStyleResponse};
|
|||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory};
|
||||
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper};
|
||||
use script_thread::SendableMainThreadScriptChan;
|
||||
use script_traits::{ConstellationControlMsg, MozBrowserEvent, UntrustedNodeAddress};
|
||||
use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress};
|
||||
use script_traits::{DocumentState, TimerEvent, TimerEventId};
|
||||
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, WindowSizeData};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
|
|
|
@ -71,7 +71,7 @@ use js::jsval::UndefinedValue;
|
|||
use js::rust::Runtime;
|
||||
use layout_wrapper::ServoLayoutNode;
|
||||
use mem::heap_size_of_self_and_children;
|
||||
use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace};
|
||||
use msg::constellation_msg::{FrameType, PipelineId, PipelineNamespace};
|
||||
use msg::constellation_msg::{ReferrerPolicy, WindowSizeType};
|
||||
use net_traits::{AsyncResponseTarget, CoreResourceMsg, LoadConsumer, LoadContext, Metadata, ResourceThreads};
|
||||
use net_traits::{IpcSend, LoadData as NetLoadData};
|
||||
|
@ -84,7 +84,7 @@ use script_layout_interface::message::{self, NewLayoutThreadInfo, ReflowQueryTyp
|
|||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory, EnqueuedPromiseCallback};
|
||||
use script_runtime::{ScriptPort, StackRootTLS, get_reports, new_rt_and_cx, PromiseJobQueue};
|
||||
use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult};
|
||||
use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent};
|
||||
use script_traits::{InitialScriptState, LoadData, MouseButton, MouseEventType, MozBrowserEvent};
|
||||
use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource};
|
||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData};
|
||||
|
|
|
@ -18,6 +18,7 @@ euclid = "0.10.1"
|
|||
gfx_traits = {path = "../gfx_traits"}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
hyper = "0.9.9"
|
||||
hyper_serde = "0.1.4"
|
||||
ipc-channel = "0.5"
|
||||
libc = "0.2"
|
||||
|
|
|
@ -17,6 +17,7 @@ extern crate devtools_traits;
|
|||
extern crate euclid;
|
||||
extern crate gfx_traits;
|
||||
extern crate heapsize;
|
||||
extern crate hyper;
|
||||
extern crate hyper_serde;
|
||||
extern crate ipc_channel;
|
||||
extern crate libc;
|
||||
|
@ -46,9 +47,11 @@ use gfx_traits::DevicePixel;
|
|||
use gfx_traits::Epoch;
|
||||
use gfx_traits::StackingContextId;
|
||||
use heapsize::HeapSizeOf;
|
||||
use hyper::header::Headers;
|
||||
use hyper::method::Method;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use libc::c_void;
|
||||
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
|
||||
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
||||
use net_traits::{LoadOrigin, ResourceThreads};
|
||||
|
@ -119,6 +122,43 @@ pub enum LayoutControlMsg {
|
|||
GetWebFontLoadState(IpcSender<bool>),
|
||||
}
|
||||
|
||||
/// Similar to net::resource_thread::LoadData
|
||||
/// can be passed to LoadUrl to load a page with GET/POST
|
||||
/// parameters or headers
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct LoadData {
|
||||
/// The URL.
|
||||
pub url: Url,
|
||||
/// The method.
|
||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||
serialize_with = "::hyper_serde::serialize")]
|
||||
pub method: Method,
|
||||
/// The headers.
|
||||
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
||||
serialize_with = "::hyper_serde::serialize")]
|
||||
pub headers: Headers,
|
||||
/// The data.
|
||||
pub data: Option<Vec<u8>>,
|
||||
/// The referrer policy.
|
||||
pub referrer_policy: Option<ReferrerPolicy>,
|
||||
/// The referrer URL.
|
||||
pub referrer_url: Option<Url>,
|
||||
}
|
||||
|
||||
impl LoadData {
|
||||
/// Create a new `LoadData` object.
|
||||
pub fn new(url: Url, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<Url>) -> LoadData {
|
||||
LoadData {
|
||||
url: url,
|
||||
method: Method::Get,
|
||||
headers: Headers::new(),
|
||||
data: None,
|
||||
referrer_policy: referrer_policy,
|
||||
referrer_url: referrer_url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The initial data associated with a newly-created framed pipeline.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct NewLayoutInfo {
|
||||
|
|
|
@ -6,6 +6,7 @@ use AnimationState;
|
|||
use CompositorEvent;
|
||||
use DocumentState;
|
||||
use IFrameLoadInfo;
|
||||
use LoadData;
|
||||
use MozBrowserEvent;
|
||||
use WorkerGlobalScopeInit;
|
||||
use WorkerScriptLoadOrigin;
|
||||
|
@ -14,7 +15,7 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
|||
use euclid::point::Point2D;
|
||||
use euclid::size::Size2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{PipelineId, TraversalDirection};
|
||||
use net_traits::CoreResourceMsg;
|
||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||
|
|
4
components/servo/Cargo.lock
generated
4
components/servo/Cargo.lock
generated
|
@ -1385,13 +1385,10 @@ dependencies = [
|
|||
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.6.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
|
@ -2046,6 +2043,7 @@ dependencies = [
|
|||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -33,12 +33,12 @@ use hyper::method::Method::{self, Post};
|
|||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use keys::keycodes_to_keys;
|
||||
use msg::constellation_msg::{FrameId, LoadData, PipelineId};
|
||||
use msg::constellation_msg::{FrameId, PipelineId};
|
||||
use msg::constellation_msg::{PixelFormat, TraversalDirection};
|
||||
use regex::Captures;
|
||||
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
|
||||
use rustc_serialize::json::{Json, ToJson};
|
||||
use script_traits::{ConstellationMsg, WebDriverCommandMsg};
|
||||
use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg};
|
||||
use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand};
|
||||
use std::borrow::ToOwned;
|
||||
|
|
4
ports/cef/Cargo.lock
generated
4
ports/cef/Cargo.lock
generated
|
@ -1285,13 +1285,10 @@ dependencies = [
|
|||
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.6.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
|
@ -1887,6 +1884,7 @@ dependencies = [
|
|||
"gfx_traits 0.0.1",
|
||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue