Add lots of derived Debug impls

This commit is contained in:
Alan Jeffrey 2018-10-26 16:44:45 -05:00
parent e580250d5d
commit 05391e27cd
23 changed files with 125 additions and 124 deletions

View file

@ -14,7 +14,7 @@ pub mod scanfilter;
use ipc_channel::ipc::IpcSender;
use scanfilter::{BluetoothScanfilterSequence, RequestDeviceoptions};
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothError {
Type(String),
Network,
@ -24,7 +24,7 @@ pub enum BluetoothError {
InvalidState,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum GATTType {
PrimaryService,
Characteristic,
@ -32,21 +32,21 @@ pub enum GATTType {
Descriptor,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothDeviceMsg {
// Bluetooth Device properties
pub id: String,
pub name: Option<String>,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothServiceMsg {
pub uuid: String,
pub is_primary: bool,
pub instance_id: String,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothCharacteristicMsg {
// Characteristic
pub uuid: String,
@ -63,7 +63,7 @@ pub struct BluetoothCharacteristicMsg {
pub writable_auxiliaries: bool,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothDescriptorMsg {
pub uuid: String,
pub instance_id: String,
@ -79,7 +79,7 @@ pub type BluetoothResult<T> = Result<T, BluetoothError>;
pub type BluetoothResponseResult = Result<BluetoothResponse, BluetoothError>;
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothRequest {
RequestDevice(RequestDeviceoptions, IpcSender<BluetoothResponseResult>),
GATTServerConnect(String, IpcSender<BluetoothResponseResult>),
@ -107,7 +107,7 @@ pub enum BluetoothRequest {
Exit,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum BluetoothResponse {
RequestDevice(BluetoothDeviceMsg),
GATTServerConnect(bool),

View file

@ -10,7 +10,7 @@ use std::slice::Iter;
// That leaves 29 bytes for the name.
const MAX_NAME_LENGTH: usize = 29;
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct ServiceUUIDSequence(Vec<String>);
impl ServiceUUIDSequence {
@ -26,7 +26,7 @@ impl ServiceUUIDSequence {
type ManufacturerData = HashMap<u16, (Vec<u8>, Vec<u8>)>;
type ServiceData = HashMap<String, (Vec<u8>, Vec<u8>)>;
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothScanfilter {
name: Option<String>,
name_prefix: String,
@ -83,7 +83,7 @@ impl BluetoothScanfilter {
}
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct BluetoothScanfilterSequence(Vec<BluetoothScanfilter>);
impl BluetoothScanfilterSequence {
@ -110,7 +110,7 @@ impl BluetoothScanfilterSequence {
}
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct RequestDeviceoptions {
filters: BluetoothScanfilterSequence,
optional_services: ServiceUUIDSequence,

View file

@ -10,13 +10,13 @@ use std::default::Default;
use std::str::FromStr;
use webrender_api;
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FillRule {
Nonzero,
Evenodd,
}
#[derive(Clone, Copy, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct CanvasId(pub u64);
#[derive(Deserialize, Serialize)]
@ -30,12 +30,12 @@ pub enum CanvasMsg {
Exit,
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CanvasImageData {
pub image_key: webrender_api::ImageKey,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum Canvas2dMsg {
Arc(Point2D<f32>, f32, f32, f32, bool),
ArcTo(Point2D<f32>, Point2D<f32>, f32),
@ -77,23 +77,23 @@ pub enum Canvas2dMsg {
SetShadowColor(RGBA),
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FromLayoutMsg {
SendData(IpcSender<CanvasImageData>),
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FromScriptMsg {
SendPixels(IpcSender<Option<ByteBuf>>),
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct CanvasGradientStop {
pub offset: f64,
pub color: RGBA,
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct LinearGradientStyle {
pub x0: f64,
pub y0: f64,
@ -115,7 +115,7 @@ impl LinearGradientStyle {
}
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct RadialGradientStyle {
pub x0: f64,
pub y0: f64,
@ -141,7 +141,7 @@ impl RadialGradientStyle {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SurfaceStyle {
pub surface_data: ByteBuf,
pub surface_size: Size2D<u32>,
@ -166,7 +166,7 @@ impl SurfaceStyle {
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FillOrStrokeStyle {
Color(RGBA),
LinearGradient(LinearGradientStyle),
@ -174,7 +174,7 @@ pub enum FillOrStrokeStyle {
Surface(SurfaceStyle),
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum LineCapStyle {
Butt = 0,
Round = 1,
@ -194,7 +194,7 @@ impl FromStr for LineCapStyle {
}
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum LineJoinStyle {
Round = 0,
Bevel = 1,
@ -214,7 +214,7 @@ impl FromStr for LineJoinStyle {
}
}
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum RepetitionStyle {
Repeat,
RepeatX,
@ -236,7 +236,7 @@ impl FromStr for RepetitionStyle {
}
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CompositionStyle {
SrcIn,
SrcOut,
@ -290,7 +290,7 @@ impl CompositionStyle {
}
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum BlendingStyle {
Multiply,
Screen,
@ -356,7 +356,7 @@ impl BlendingStyle {
}
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CompositionOrBlending {
Composition(CompositionStyle),
Blending(BlendingStyle),

View file

@ -24,7 +24,7 @@ pub use ::webgl_channel::WebGLPipeline;
/// Entry point channel type used for sending WebGLMsg messages to the WebGL renderer.
pub use ::webgl_channel::WebGLChan;
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLCommandBacktrace {
#[cfg(feature = "webgl_backtrace")]
pub backtrace: String,
@ -33,7 +33,7 @@ pub struct WebGLCommandBacktrace {
}
/// WebGL Message API
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebGLMsg {
/// Creates a new WebGLContext.
CreateContext(
@ -70,7 +70,7 @@ pub enum WebGLMsg {
}
/// Contains the WebGLCommand sender and information about a WebGLContext
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLCreateContextResult {
/// Sender instance to send commands to the specific WebGLContext
pub sender: WebGLMsgSender,
@ -82,7 +82,7 @@ pub struct WebGLCreateContextResult {
pub glsl_version: WebGLSLVersion,
}
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum WebGLContextShareMode {
/// Fast: a shared texture_id is used in WebRender.
SharedTexture,
@ -91,7 +91,7 @@ pub enum WebGLContextShareMode {
}
/// Defines the WebGL version
#[derive(Clone, Copy, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum WebGLVersion {
/// https://www.khronos.org/registry/webgl/specs/1.0.2/
/// Conforms closely to the OpenGL ES 2.0 API
@ -102,7 +102,7 @@ pub enum WebGLVersion {
}
/// Defines the GLSL version supported by the WebGL backend contexts.
#[derive(Clone, Copy, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub struct WebGLSLVersion {
/// Major GLSL version
pub major: u32,
@ -111,7 +111,7 @@ pub struct WebGLSLVersion {
}
/// Helper struct to send WebGLCommands to a specific WebGLContext.
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct WebGLMsgSender {
ctx_id: WebGLContextId,
#[ignore_malloc_size_of = "channels are hard"]
@ -414,7 +414,7 @@ pub type WebGLResult<T> = Result<T, WebGLError>;
pub type WebVRDeviceId = u32;
// WebVR commands that must be called in the WebGL render thread.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum WebVRCommand {
/// Start presenting to a VR device.
Create(WebVRDeviceId),
@ -433,7 +433,7 @@ pub trait WebVRRenderHandler: Send {
}
/// WebGL commands required to implement DOMToTexture feature.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum DOMToTextureCommand {
/// Attaches a HTMLIFrameElement to a WebGLTexture.
Attach(WebGLContextId, WebGLTextureId, DocumentId, PipelineId, Size2D<i32>),
@ -444,7 +444,7 @@ pub enum DOMToTextureCommand {
}
/// Information about a WebGL program linking operation.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ProgramLinkInfo {
/// Whether the program was linked successfully.
pub linked: bool,
@ -455,7 +455,7 @@ pub struct ProgramLinkInfo {
}
/// Description of a single active attribute.
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ActiveAttribInfo {
/// The name of the attribute.
pub name: String,
@ -468,7 +468,7 @@ pub struct ActiveAttribInfo {
}
/// Description of a single active uniform.
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ActiveUniformInfo {
/// The base name of the uniform.
pub base_name: Box<str>,

View file

@ -85,7 +85,7 @@ where
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLChan(pub WebGLSender<WebGLMsg>);
impl WebGLChan {
@ -95,7 +95,7 @@ impl WebGLChan {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WebGLPipeline(pub WebGLChan);
impl WebGLPipeline {

View file

@ -23,7 +23,7 @@ use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use url::{self, Url};
/// Global flags for Servo, currently set on the command line.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Opts {
pub is_running_problem_test: bool,
@ -474,7 +474,7 @@ fn print_debug_usage(app: &str) -> ! {
process::exit(0)
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum OutputOptions {
/// Database connection config (hostname, name, user, pass)
DB(ServoUrl, Option<String>, Option<String>, Option<String>),

View file

@ -864,6 +864,7 @@ where
/// Handles loading pages, navigation, and granting access to the compositor
fn handle_request(&mut self) {
#[derive(Debug)]
enum Request {
Script((PipelineId, FromScriptMsg)),
Compositor(FromCompositorMsg),

View file

@ -23,7 +23,7 @@ thread_local! {
}
/// A single "paragraph" of text in one font size and style.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TextRun {
/// The UTF-8 string represented by this text run.
pub text: Arc<String>,
@ -51,7 +51,7 @@ impl Drop for TextRun {
}
/// A single series of glyphs within a text run.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GlyphRun {
/// The glyphs.
pub glyph_store: Arc<GlyphStore>,

View file

@ -270,7 +270,7 @@ pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId = BrowsingContextId {
// Used to specify the kind of input method editor appropriate to edit a field.
// This is a subset of htmlinputelement::InputType because some variants of InputType
// don't make sense in this context.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum InputMethodType {
Color,
Date,

View file

@ -11,7 +11,7 @@ use std::collections::HashMap;
use std::net::{Ipv4Addr, Ipv6Addr};
use time;
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HstsEntry {
pub host: String,
pub include_subdomains: bool,
@ -52,7 +52,7 @@ impl HstsEntry {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HstsList {
pub entries_map: HashMap<String, Vec<HstsEntry>>,
}

View file

@ -345,7 +345,7 @@ pub fn write_json_to_file<T>(data: &T, config_dir: &Path, filename: &str)
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AuthCacheEntry {
pub user_name: String,
pub password: String,
@ -360,7 +360,7 @@ impl AuthCache {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AuthCache {
pub version: u32,
pub entries: HashMap<String, AuthCacheEntry>,

View file

@ -19,7 +19,7 @@ pub type FileOrigin = String;
/// Relative slice positions of a sequence,
/// whose semantic should be consistent with (start, end) parameters in
/// <https://w3c.github.io/FileAPI/#dfn-slice>
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RelativePos {
/// Relative to first byte if non-negative,
/// relative to one past last byte if negative,
@ -111,7 +111,7 @@ pub struct SelectedFile {
pub type_string: String,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum FileManagerThreadMsg {
/// Select a single file. Last field is pre-selected file path for testing
SelectFile(Vec<FilterPattern>, IpcSender<FileManagerResult<SelectedFile>>, FileOrigin, Option<String>),

View file

@ -16,14 +16,14 @@ use webrender_api;
/// Whether a consumer is in a position to request images or not. This can occur
/// when animations are being processed by the layout thread while the script
/// thread is executing in parallel.
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum CanRequestImages {
No,
Yes,
}
/// Indicating either entire image or just metadata availability
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum ImageOrMetadataAvailable {
ImageAvailable(#[ignore_malloc_size_of = "Arc"] Arc<Image>, ServoUrl),
MetadataAvailable(ImageMetadata),
@ -33,7 +33,7 @@ pub enum ImageOrMetadataAvailable {
/// and image, and returned to the specified event loop when the
/// image load completes. It is typically used to trigger a reflow
/// and/or repaint.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ImageResponder {
id: PendingImageId,
sender: IpcSender<PendingImageResponse>,
@ -73,7 +73,7 @@ pub enum ImageResponse {
}
/// The current state of an image in the cache.
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum ImageState {
Pending(PendingImageId),
LoadError,
@ -90,7 +90,7 @@ pub struct PendingImageResponse {
pub id: PendingImageId,
}
#[derive(Clone, Copy, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum UsePlaceholder {
No,
Yes,

View file

@ -62,7 +62,7 @@ pub mod image {
/// A loading context, for context-specific sniffing, as defined in
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum LoadContext {
Browsing,
Image,
@ -98,7 +98,7 @@ impl CustomResponse {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CustomResponseMediator {
pub response_chan: IpcSender<Option<CustomResponse>>,
pub load_url: ServoUrl,
@ -149,7 +149,7 @@ impl<'a> From<&'a ReferrerPolicyHeader> for ReferrerPolicy {
}
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum FetchResponseMsg {
// todo: should have fields for transmitted/total bytes
ProcessRequestBody,
@ -185,7 +185,7 @@ pub trait FetchTaskTarget {
fn process_response_eof(&mut self, response: &Response);
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FilteredMetadata {
Basic(Metadata),
Cors(Metadata),
@ -193,7 +193,7 @@ pub enum FilteredMetadata {
OpaqueRedirect
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum FetchMetadata {
Unfiltered(Metadata),
Filtered {
@ -276,7 +276,7 @@ pub trait IpcSend<T>
// the "Arc" hack implicitly in future.
// See discussion: http://logs.glob.uno/?c=mozilla%23servo&s=16+May+2016&e=16+May+2016#c430412
// See also: https://github.com/servo/servo/blob/735480/components/script/script_thread.rs#L313
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ResourceThreads {
core_thread: CoreResourceThread,
storage_thread: IpcSender<StorageThreadMsg>,
@ -314,25 +314,25 @@ impl IpcSend<StorageThreadMsg> for ResourceThreads {
// Ignore the sub-fields
malloc_size_of_is_0!(ResourceThreads);
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum IncludeSubdomains {
Included,
NotIncluded,
}
#[derive(Deserialize, MallocSizeOf, Serialize)]
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum MessageData {
Text(String),
Binary(Vec<u8>),
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebSocketDomAction {
SendMessage(MessageData),
Close(Option<u16>, Option<String>),
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebSocketNetworkEvent {
ConnectionEstablished {
protocol_in_use: Option<String>,
@ -342,7 +342,7 @@ pub enum WebSocketNetworkEvent {
Fail,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
/// IPC channels to communicate with the script thread about network or DOM events.
pub enum FetchChannels {
ResponseMsg(IpcSender<FetchResponseMsg>, /* cancel_chan */ Option<IpcReceiver<()>>),
@ -352,7 +352,7 @@ pub enum FetchChannels {
}
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum CoreResourceMsg {
Fetch(RequestInit, FetchChannels),
/// Initiate a fetch in response to processing a redirection
@ -393,7 +393,7 @@ pub fn fetch_async<F>(request: RequestInit, core_resource_thread: &CoreResourceT
CoreResourceMsg::Fetch(request, FetchChannels::ResponseMsg(action_sender, None))).unwrap();
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ResourceCorsData {
/// CORS Preflight flag
pub preflight: bool,
@ -402,7 +402,7 @@ pub struct ResourceCorsData {
}
/// Metadata about a loaded resource, such as is obtained from HTTP headers.
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct Metadata {
/// Final URL after redirects.
pub final_url: ServoUrl,
@ -471,7 +471,7 @@ impl Metadata {
}
/// The creator of a given cookie
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum CookieSource {
/// An HTTP API
HTTP,

View file

@ -20,7 +20,7 @@ pub enum Initiator {
}
/// A request [destination](https://fetch.spec.whatwg.org/#concept-request-destination)
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Destination {
None,
Audio,
@ -60,7 +60,7 @@ pub enum Origin {
}
/// A [referer](https://fetch.spec.whatwg.org/#concept-request-referrer)
#[derive(Clone, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum Referrer {
NoReferrer,
/// Default referrer if nothing is specified
@ -69,7 +69,7 @@ pub enum Referrer {
}
/// A [request mode](https://fetch.spec.whatwg.org/#concept-request-mode)
#[derive(Clone, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum RequestMode {
Navigate,
SameOrigin,
@ -79,7 +79,7 @@ pub enum RequestMode {
}
/// Request [credentials mode](https://fetch.spec.whatwg.org/#concept-request-credentials-mode)
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CredentialsMode {
Omit,
CredentialsSameOrigin,
@ -87,7 +87,7 @@ pub enum CredentialsMode {
}
/// [Cache mode](https://fetch.spec.whatwg.org/#concept-request-cache-mode)
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum CacheMode {
Default,
NoStore,
@ -98,7 +98,7 @@ pub enum CacheMode {
}
/// [Service-workers mode](https://fetch.spec.whatwg.org/#request-service-workers-mode)
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum ServiceWorkersMode {
All,
Foreign,
@ -106,7 +106,7 @@ pub enum ServiceWorkersMode {
}
/// [Redirect mode](https://fetch.spec.whatwg.org/#concept-request-redirect-mode)
#[derive(Clone, Copy, Deserialize, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum RedirectMode {
Follow,
Error,
@ -129,13 +129,13 @@ pub enum Window {
}
/// [CORS settings attribute](https://html.spec.whatwg.org/multipage/#attr-crossorigin-anonymous)
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum CorsSettings {
Anonymous,
UseCredentials,
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct RequestInit {
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]

View file

@ -75,7 +75,7 @@ pub enum ResponseMsg {
Errored,
}
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ResponseInit {
pub url: ServoUrl,
#[serde(deserialize_with = "::hyper_serde::deserialize",

View file

@ -5,14 +5,14 @@
use ipc_channel::ipc::IpcSender;
use servo_url::ServoUrl;
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum StorageType {
Session,
Local,
}
/// Request operations on the storage data associated with a particular url
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum StorageThreadMsg {
/// gets the number of key/value pairs present in the associated storage data
Length(IpcSender<usize>, ServoUrl, StorageType),

View file

@ -45,7 +45,7 @@ where
/// Front-end representation of the profiler used to communicate with the
/// profiler.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ProfilerChan(pub IpcSender<ProfilerMsg>);
impl ProfilerChan {
@ -102,7 +102,7 @@ impl ProfilerChan {
/// and thread stacks. "explicit" is not guaranteed to cover every explicit allocation, but it does
/// cover most (including the entire heap), and therefore it is the single best number to focus on
/// when trying to reduce memory usage.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum ReportKind {
/// A size measurement for an explicit allocation on the jemalloc heap. This should be used
/// for any measurements done via the `MallocSizeOf` trait.
@ -126,7 +126,7 @@ pub enum ReportKind {
}
/// A single memory-related measurement.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Report {
/// The identifying path for this report.
pub path: Vec<String>,
@ -139,7 +139,7 @@ pub struct Report {
}
/// A channel through which memory reports can be sent.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ReportsChan(pub IpcSender<Vec<Report>>);
impl ReportsChan {
@ -152,7 +152,7 @@ impl ReportsChan {
}
/// The protocol used to send reporter requests.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct ReporterRequest {
/// The channel on which reports are to be sent.
pub reports_channel: ReportsChan,
@ -165,7 +165,7 @@ pub struct ReporterRequest {
/// In many cases, clients construct `Reporter` objects by creating an IPC sender/receiver pair and
/// registering the receiving end with the router so that messages from the memory profiler end up
/// injected into the client's event loop.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Reporter(pub IpcSender<ReporterRequest>);
impl Reporter {
@ -188,7 +188,7 @@ macro_rules! path {
}
/// Messages that can be sent to the memory profiler thread.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum ProfilerMsg {
/// Register a Reporter with the memory profiler. The String is only used to identify the
/// reporter so it can be unregistered later. The String must be distinct from that used by any

View file

@ -17,7 +17,7 @@ pub struct TimerMetadata {
pub incremental: TimerMetadataReflowType,
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ProfilerChan(pub IpcSender<ProfilerMsg>);
impl ProfilerChan {
@ -28,13 +28,13 @@ impl ProfilerChan {
}
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum ProfilerData {
NoRecords,
Record(Vec<f64>),
}
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum ProfilerMsg {
/// Normal message used for reporting time
Time(

View file

@ -112,7 +112,7 @@ impl UntrustedNodeAddress {
}
/// Messages sent to the layout thread from the constellation and/or compositor.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum LayoutControlMsg {
/// Requests that this layout thread exit.
ExitNow,
@ -191,7 +191,7 @@ impl LoadData {
}
/// The initial data required to create a new layout attached to an existing script thread.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct NewLayoutInfo {
/// The ID of the parent pipeline and frame type, if any.
/// If `None`, this is a root pipeline.
@ -217,7 +217,7 @@ pub struct NewLayoutInfo {
}
/// When a pipeline is closed, should its browsing context be discarded too?
#[derive(Clone, Copy, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum DiscardBrowsingContext {
/// Discard the browsing context
Yes,
@ -446,7 +446,7 @@ pub enum MouseButton {
}
/// The types of mouse events
#[derive(Deserialize, MallocSizeOf, Serialize)]
#[derive(Debug, Deserialize, MallocSizeOf, Serialize)]
pub enum MouseEventType {
/// Mouse button clicked
Click,
@ -457,7 +457,7 @@ pub enum MouseEventType {
}
/// Events from the compositor that the script thread needs to know about
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum CompositorEvent {
/// The window was resized.
ResizeEvent(WindowSizeData, WindowSizeType),
@ -483,7 +483,7 @@ pub enum CompositorEvent {
}
/// Requests a TimerEvent-Message be sent after the given duration.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct TimerEventRequest(
pub IpcSender<TimerEvent>,
pub TimerSource,
@ -492,7 +492,7 @@ pub struct TimerEventRequest(
);
/// Type of messages that can be sent to the timer scheduler.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum TimerSchedulerMsg {
/// Message to schedule a new timer event.
Request(TimerEventRequest),
@ -616,7 +616,7 @@ pub enum IFrameSandboxState {
}
/// Specifies the information required to load an auxiliary browsing context.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct AuxiliaryBrowsingContextLoadInfo {
/// The pipeline opener browsing context.
pub opener_pipeline_id: PipelineId,
@ -629,7 +629,7 @@ pub struct AuxiliaryBrowsingContextLoadInfo {
}
/// Specifies the information required to load an iframe.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct IFrameLoadInfo {
/// Pipeline ID of the parent of this iframe
pub parent_pipeline_id: PipelineId,
@ -647,7 +647,7 @@ pub struct IFrameLoadInfo {
}
/// Specifies the information required to load a URL in an iframe.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct IFrameLoadInfoWithData {
/// The information required to load an iframe.
pub info: IFrameLoadInfo,
@ -660,7 +660,7 @@ pub struct IFrameLoadInfoWithData {
}
/// Specifies whether the script or layout thread needs to be ticked for animation.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum AnimationTickType {
/// The script thread.
Script,
@ -678,7 +678,7 @@ pub struct ScrollState {
}
/// Data about the window size.
#[derive(Clone, Copy, Deserialize, MallocSizeOf, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct WindowSizeData {
/// The size of the initial layout viewport, before parsing an
/// <http://www.w3.org/TR/css-device-adapt/#initial-viewport>
@ -689,7 +689,7 @@ pub struct WindowSizeData {
}
/// The type of window size change.
#[derive(Clone, Copy, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)]
pub enum WindowSizeType {
/// Initial load.
Initial,
@ -698,7 +698,7 @@ pub enum WindowSizeType {
}
/// Messages to the constellation originating from the WebDriver server.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverCommandMsg {
/// Get the window size.
GetWindowSize(TopLevelBrowsingContextId, IpcSender<WindowSizeData>),
@ -803,7 +803,7 @@ impl fmt::Debug for ConstellationMsg {
}
/// Resources required by workerglobalscopes
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WorkerGlobalScopeInit {
/// Chan to a resource thread
pub resource_threads: ResourceThreads,
@ -828,7 +828,7 @@ pub struct WorkerGlobalScopeInit {
}
/// Common entities representing a network load origin
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WorkerScriptLoadOrigin {
/// referrer url
pub referrer_url: Option<ServoUrl>,
@ -885,7 +885,7 @@ pub struct DrawAPaintImageResult {
}
/// A Script to Constellation channel.
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ScriptToConstellationChan {
/// Sender for communicating with constellation thread.
pub sender: IpcSender<(PipelineId, ScriptMsg)>,

View file

@ -61,7 +61,7 @@ impl fmt::Debug for LayoutMsg {
}
/// Whether a DOM event was prevented by web content
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum EventResult {
/// Allowed by web content
DefaultAllowed,
@ -241,7 +241,7 @@ impl fmt::Debug for ScriptMsg {
}
/// Entities required to spawn service workers
#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ScopeThings {
/// script resource url
pub script_url: ServoUrl,
@ -268,7 +268,7 @@ pub struct SWManagerSenders {
}
/// Messages sent to Service Worker Manager thread
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum ServiceWorkerMsg {
/// Message to register the service worker
RegisterServiceWorker(ScopeThings, ServoUrl),
@ -281,7 +281,7 @@ pub enum ServiceWorkerMsg {
}
/// Messages outgoing from the Service Worker Manager thread to constellation
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum SWManagerMsg {
/// Provide the constellation with a means of communicating with the Service Worker Manager
OwnSender(IpcSender<ServiceWorkerMsg>),

View file

@ -12,7 +12,7 @@ use msg::constellation_msg::BrowsingContextId;
use rustc_serialize::json::{Json, ToJson};
use servo_url::ServoUrl;
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverScriptCommand {
AddCookie(
#[serde(
@ -42,13 +42,13 @@ pub enum WebDriverScriptCommand {
GetTitle(IpcSender<String>),
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverCookieError {
InvalidDomain,
UnableToSetCookie,
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverJSValue {
Undefined,
Null,
@ -57,7 +57,7 @@ pub enum WebDriverJSValue {
String(String), // TODO: Object and WebElement
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverJSError {
Timeout,
UnknownType,
@ -68,7 +68,7 @@ pub enum WebDriverJSError {
pub type WebDriverJSResult = Result<WebDriverJSValue, WebDriverJSError>;
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebDriverFrameId {
Short(u16),
Element(String),
@ -87,7 +87,7 @@ impl ToJson for WebDriverJSValue {
}
}
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum LoadStatus {
LoadComplete,
LoadTimeout,

View file

@ -9,7 +9,7 @@ use webvr::*;
pub type WebVRResult<T> = Result<T, String>;
// Messages from Script thread to WebVR thread.
#[derive(Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize)]
pub enum WebVRMsg {
RegisterContext(PipelineId),
UnregisterContext(PipelineId),