From 05391e27cda2f394adc5c16584bcbc55d921eb5e Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Fri, 26 Oct 2018 16:44:45 -0500 Subject: [PATCH] Add lots of derived Debug impls --- components/bluetooth_traits/lib.rs | 16 ++++----- components/bluetooth_traits/scanfilter.rs | 8 ++--- components/canvas_traits/canvas.rs | 34 +++++++++---------- components/canvas_traits/webgl.rs | 24 ++++++------- components/canvas_traits/webgl_channel/mod.rs | 4 +-- components/config/opts.rs | 4 +-- components/constellation/constellation.rs | 1 + components/gfx/text/text_run.rs | 4 +-- components/msg/constellation_msg.rs | 2 +- components/net/hsts.rs | 4 +-- components/net/resource_thread.rs | 4 +-- components/net_traits/filemanager_thread.rs | 4 +-- components/net_traits/image_cache.rs | 10 +++--- components/net_traits/lib.rs | 30 ++++++++-------- components/net_traits/request.rs | 18 +++++----- components/net_traits/response.rs | 2 +- components/net_traits/storage_thread.rs | 4 +-- components/profile_traits/mem.rs | 14 ++++---- components/profile_traits/time.rs | 6 ++-- components/script_traits/lib.rs | 34 +++++++++---------- components/script_traits/script_msg.rs | 8 ++--- components/script_traits/webdriver_msg.rs | 12 +++---- components/webvr_traits/webvr_traits.rs | 2 +- 23 files changed, 125 insertions(+), 124 deletions(-) diff --git a/components/bluetooth_traits/lib.rs b/components/bluetooth_traits/lib.rs index 0925234666b0..ef9b58237eb3 100644 --- a/components/bluetooth_traits/lib.rs +++ b/components/bluetooth_traits/lib.rs @@ -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, } -#[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 = Result; pub type BluetoothResponseResult = Result; -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub enum BluetoothRequest { RequestDevice(RequestDeviceoptions, IpcSender), GATTServerConnect(String, IpcSender), @@ -107,7 +107,7 @@ pub enum BluetoothRequest { Exit, } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub enum BluetoothResponse { RequestDevice(BluetoothDeviceMsg), GATTServerConnect(bool), diff --git a/components/bluetooth_traits/scanfilter.rs b/components/bluetooth_traits/scanfilter.rs index cde3d172a25b..099b9372a4e6 100644 --- a/components/bluetooth_traits/scanfilter.rs +++ b/components/bluetooth_traits/scanfilter.rs @@ -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); impl ServiceUUIDSequence { @@ -26,7 +26,7 @@ impl ServiceUUIDSequence { type ManufacturerData = HashMap, Vec)>; type ServiceData = HashMap, Vec)>; -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub struct BluetoothScanfilter { name: Option, name_prefix: String, @@ -83,7 +83,7 @@ impl BluetoothScanfilter { } } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub struct BluetoothScanfilterSequence(Vec); impl BluetoothScanfilterSequence { @@ -110,7 +110,7 @@ impl BluetoothScanfilterSequence { } } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub struct RequestDeviceoptions { filters: BluetoothScanfilterSequence, optional_services: ServiceUUIDSequence, diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs index b78c9da08ea5..fad9679e4830 100644 --- a/components/canvas_traits/canvas.rs +++ b/components/canvas_traits/canvas.rs @@ -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, bool), ArcTo(Point2D, Point2D, f32), @@ -77,23 +77,23 @@ pub enum Canvas2dMsg { SetShadowColor(RGBA), } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub enum FromLayoutMsg { SendData(IpcSender), } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub enum FromScriptMsg { SendPixels(IpcSender>), } -#[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, @@ -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), diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index c3912ad16269..d69503c6fa2e 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -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 = Result; 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), @@ -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, diff --git a/components/canvas_traits/webgl_channel/mod.rs b/components/canvas_traits/webgl_channel/mod.rs index 3c6bd1690b0d..84986afc3494 100644 --- a/components/canvas_traits/webgl_channel/mod.rs +++ b/components/canvas_traits/webgl_channel/mod.rs @@ -85,7 +85,7 @@ where } } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct WebGLChan(pub WebGLSender); impl WebGLChan { @@ -95,7 +95,7 @@ impl WebGLChan { } } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct WebGLPipeline(pub WebGLChan); impl WebGLPipeline { diff --git a/components/config/opts.rs b/components/config/opts.rs index 1f6c6ecad464..2d16d823030a 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -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, Option, Option), diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 95efb23b2ea2..581f72240bd1 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -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), diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index 39b96a934e65..3eab1cd738de 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -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, @@ -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, diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index c315a63ee440..932cf7d22d86 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -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, diff --git a/components/net/hsts.rs b/components/net/hsts.rs index 49d7168e5721..d1268a958ad9 100644 --- a/components/net/hsts.rs +++ b/components/net/hsts.rs @@ -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>, } diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index cddf0cb0a0b7..0754750a9528 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -345,7 +345,7 @@ pub fn write_json_to_file(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, diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs index fa0ac23d8f5c..5dd379539953 100644 --- a/components/net_traits/filemanager_thread.rs +++ b/components/net_traits/filemanager_thread.rs @@ -19,7 +19,7 @@ pub type FileOrigin = String; /// Relative slice positions of a sequence, /// whose semantic should be consistent with (start, end) parameters in /// -#[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, IpcSender>, FileOrigin, Option), diff --git a/components/net_traits/image_cache.rs b/components/net_traits/image_cache.rs index 85db07931486..ca6df6ee516d 100644 --- a/components/net_traits/image_cache.rs +++ b/components/net_traits/image_cache.rs @@ -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, 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, @@ -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, diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 7066a3f1f283..85862b99a116 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -62,7 +62,7 @@ pub mod image { /// A loading context, for context-specific sniffing, as defined in /// -#[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>, 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 // 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, @@ -314,25 +314,25 @@ impl IpcSend 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), } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub enum WebSocketDomAction { SendMessage(MessageData), Close(Option, Option), } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub enum WebSocketNetworkEvent { ConnectionEstablished { protocol_in_use: Option, @@ -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, /* cancel_chan */ Option>), @@ -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(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, diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs index 13120f6868a7..822a39ee324c 100644 --- a/components/net_traits/request.rs +++ b/components/net_traits/request.rs @@ -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")] diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs index 76278db19c75..4b0a64460ce1 100644 --- a/components/net_traits/response.rs +++ b/components/net_traits/response.rs @@ -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", diff --git a/components/net_traits/storage_thread.rs b/components/net_traits/storage_thread.rs index 12047d084431..af7a8cbde925 100644 --- a/components/net_traits/storage_thread.rs +++ b/components/net_traits/storage_thread.rs @@ -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, ServoUrl, StorageType), diff --git a/components/profile_traits/mem.rs b/components/profile_traits/mem.rs index b40d8a855864..29776e6bc3bb 100644 --- a/components/profile_traits/mem.rs +++ b/components/profile_traits/mem.rs @@ -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); 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, @@ -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>); 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); 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 diff --git a/components/profile_traits/time.rs b/components/profile_traits/time.rs index 9f3c41740ff4..4ec3a3981714 100644 --- a/components/profile_traits/time.rs +++ b/components/profile_traits/time.rs @@ -17,7 +17,7 @@ pub struct TimerMetadata { pub incremental: TimerMetadataReflowType, } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct ProfilerChan(pub IpcSender); impl ProfilerChan { @@ -28,13 +28,13 @@ impl ProfilerChan { } } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub enum ProfilerData { NoRecords, Record(Vec), } -#[derive(Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub enum ProfilerMsg { /// Normal message used for reporting time Time( diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 341212c87076..cc9787d47215 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -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, 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 /// @@ -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), @@ -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, @@ -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)>, diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 3ec821141267..f7c075f8cd82 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -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), diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs index b24aeca51980..cae235388a31 100644 --- a/components/script_traits/webdriver_msg.rs +++ b/components/script_traits/webdriver_msg.rs @@ -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), } -#[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; -#[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, diff --git a/components/webvr_traits/webvr_traits.rs b/components/webvr_traits/webvr_traits.rs index 86c194fc4041..9f2242ad6df4 100644 --- a/components/webvr_traits/webvr_traits.rs +++ b/components/webvr_traits/webvr_traits.rs @@ -9,7 +9,7 @@ use webvr::*; pub type WebVRResult = Result; // Messages from Script thread to WebVR thread. -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub enum WebVRMsg { RegisterContext(PipelineId), UnregisterContext(PipelineId),