Cleanup constellation debug messages

This commit is contained in:
Connor Brewster 2018-05-11 11:01:51 -06:00
parent a8bdd44ece
commit ee3c26c56c
3 changed files with 104 additions and 55 deletions

View file

@ -916,35 +916,30 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
} }
fn handle_request_from_compositor(&mut self, message: FromCompositorMsg) { fn handle_request_from_compositor(&mut self, message: FromCompositorMsg) {
debug!("constellation got {:?} message", message);
match message { match message {
FromCompositorMsg::Exit => { FromCompositorMsg::Exit => {
debug!("constellation exiting");
self.handle_exit(); self.handle_exit();
} }
FromCompositorMsg::GetBrowsingContext(pipeline_id, resp_chan) => { FromCompositorMsg::GetBrowsingContext(pipeline_id, resp_chan) => {
debug!("constellation got get browsing context message");
self.handle_get_browsing_context(pipeline_id, resp_chan); self.handle_get_browsing_context(pipeline_id, resp_chan);
} }
FromCompositorMsg::GetPipeline(browsing_context_id, resp_chan) => { FromCompositorMsg::GetPipeline(browsing_context_id, resp_chan) => {
debug!("constellation got get pipeline message");
self.handle_get_pipeline(browsing_context_id, resp_chan); self.handle_get_pipeline(browsing_context_id, resp_chan);
} }
FromCompositorMsg::GetFocusTopLevelBrowsingContext(resp_chan) => { FromCompositorMsg::GetFocusTopLevelBrowsingContext(resp_chan) => {
debug!("constellation got get focus browsing context message");
let focus_browsing_context = self.focus_pipeline_id let focus_browsing_context = self.focus_pipeline_id
.and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) .and_then(|pipeline_id| self.pipelines.get(&pipeline_id))
.map(|pipeline| pipeline.top_level_browsing_context_id); .map(|pipeline| pipeline.top_level_browsing_context_id);
let _ = resp_chan.send(focus_browsing_context); let _ = resp_chan.send(focus_browsing_context);
} }
FromCompositorMsg::KeyEvent(ch, key, state, modifiers) => { FromCompositorMsg::KeyEvent(ch, key, state, modifiers) => {
debug!("constellation got key event message");
self.handle_key_msg(ch, key, state, modifiers); self.handle_key_msg(ch, key, state, modifiers);
} }
// Load a new page from a typed url // Load a new page from a typed url
// If there is already a pending page (self.pending_changes), it will not be overridden; // If there is already a pending page (self.pending_changes), it will not be overridden;
// However, if the id is not encompassed by another change, it will be. // However, if the id is not encompassed by another change, it will be.
FromCompositorMsg::LoadUrl(top_level_browsing_context_id, url) => { FromCompositorMsg::LoadUrl(top_level_browsing_context_id, url) => {
debug!("constellation got URL load message from compositor");
let load_data = LoadData::new(url, None, None, None); let load_data = LoadData::new(url, None, None, None);
let ctx_id = BrowsingContextId::from(top_level_browsing_context_id); let ctx_id = BrowsingContextId::from(top_level_browsing_context_id);
let pipeline_id = match self.browsing_contexts.get(&ctx_id) { let pipeline_id = match self.browsing_contexts.get(&ctx_id) {
@ -968,12 +963,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Create a new top level browsing context. Will use response_chan to return // Create a new top level browsing context. Will use response_chan to return
// the browsing context id. // the browsing context id.
FromCompositorMsg::NewBrowser(url, response_chan) => { FromCompositorMsg::NewBrowser(url, response_chan) => {
debug!("constellation got NewBrowser message");
self.handle_new_top_level_browsing_context(url, response_chan); self.handle_new_top_level_browsing_context(url, response_chan);
} }
// Close a top level browsing context. // Close a top level browsing context.
FromCompositorMsg::CloseBrowser(top_level_browsing_context_id) => { FromCompositorMsg::CloseBrowser(top_level_browsing_context_id) => {
debug!("constellation got CloseBrowser message");
self.handle_close_top_level_browsing_context(top_level_browsing_context_id); self.handle_close_top_level_browsing_context(top_level_browsing_context_id);
} }
// Send frame tree to WebRender. Make it visible. // Send frame tree to WebRender. Make it visible.
@ -982,29 +975,24 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
} }
// Handle a forward or back request // Handle a forward or back request
FromCompositorMsg::TraverseHistory(top_level_browsing_context_id, direction) => { FromCompositorMsg::TraverseHistory(top_level_browsing_context_id, direction) => {
debug!("constellation got traverse history message from compositor");
self.handle_traverse_history_msg(top_level_browsing_context_id, direction); self.handle_traverse_history_msg(top_level_browsing_context_id, direction);
} }
FromCompositorMsg::WindowSize(top_level_browsing_context_id, new_size, size_type) => { FromCompositorMsg::WindowSize(top_level_browsing_context_id, new_size, size_type) => {
debug!("constellation got window resize message");
self.handle_window_size_msg(top_level_browsing_context_id, new_size, size_type); self.handle_window_size_msg(top_level_browsing_context_id, new_size, size_type);
} }
FromCompositorMsg::TickAnimation(pipeline_id, tick_type) => { FromCompositorMsg::TickAnimation(pipeline_id, tick_type) => {
self.handle_tick_animation(pipeline_id, tick_type) self.handle_tick_animation(pipeline_id, tick_type)
} }
FromCompositorMsg::WebDriverCommand(command) => { FromCompositorMsg::WebDriverCommand(command) => {
debug!("constellation got webdriver command message");
self.handle_webdriver_msg(command); self.handle_webdriver_msg(command);
} }
FromCompositorMsg::Reload(top_level_browsing_context_id) => { FromCompositorMsg::Reload(top_level_browsing_context_id) => {
debug!("constellation got reload message");
self.handle_reload_msg(top_level_browsing_context_id); self.handle_reload_msg(top_level_browsing_context_id);
} }
FromCompositorMsg::LogEntry(top_level_browsing_context_id, thread_name, entry) => { FromCompositorMsg::LogEntry(top_level_browsing_context_id, thread_name, entry) => {
self.handle_log_entry(top_level_browsing_context_id, thread_name, entry); self.handle_log_entry(top_level_browsing_context_id, thread_name, entry);
} }
FromCompositorMsg::WebVREvents(pipeline_ids, events) => { FromCompositorMsg::WebVREvents(pipeline_ids, events) => {
debug!("constellation got {:?} WebVR events", events.len());
self.handle_webvr_events(pipeline_ids, events); self.handle_webvr_events(pipeline_ids, events);
} }
FromCompositorMsg::ForwardEvent(destination_pipeline_id, event) => { FromCompositorMsg::ForwardEvent(destination_pipeline_id, event) => {
@ -1018,6 +1006,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) { fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) {
let (source_pipeline_id, content) = message; let (source_pipeline_id, content) = message;
debug!("constellation got {:?} message from pipeline {}", content, source_pipeline_id);
let source_top_ctx_id = match self.pipelines.get(&source_pipeline_id) let source_top_ctx_id = match self.pipelines.get(&source_pipeline_id)
.map(|pipeline| pipeline.top_level_browsing_context_id) { .map(|pipeline| pipeline.top_level_browsing_context_id) {
None => return warn!("ScriptMsg from closed pipeline {:?}.", source_pipeline_id), None => return warn!("ScriptMsg from closed pipeline {:?}.", source_pipeline_id),
@ -1037,20 +1027,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.handle_discard_document(source_top_ctx_id, source_pipeline_id); self.handle_discard_document(source_top_ctx_id, source_pipeline_id);
} }
FromScriptMsg::InitiateNavigateRequest(req_init, cancel_chan) => { FromScriptMsg::InitiateNavigateRequest(req_init, cancel_chan) => {
debug!("constellation got initiate navigate request message");
self.handle_navigate_request(source_pipeline_id, req_init, cancel_chan); self.handle_navigate_request(source_pipeline_id, req_init, cancel_chan);
} }
FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => { FromScriptMsg::ScriptLoadedURLInIFrame(load_info) => {
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
load_info.info.parent_pipeline_id,
load_info.old_pipeline_id,
load_info.info.new_pipeline_id);
self.handle_script_loaded_url_in_iframe_msg(load_info); self.handle_script_loaded_url_in_iframe_msg(load_info);
} }
FromScriptMsg::ScriptNewIFrame(load_info, layout_sender) => { FromScriptMsg::ScriptNewIFrame(load_info, layout_sender) => {
debug!("constellation got loaded `about:blank` in iframe message {:?} {:?}",
load_info.parent_pipeline_id,
load_info.new_pipeline_id);
self.handle_script_new_iframe(load_info, layout_sender); self.handle_script_new_iframe(load_info, layout_sender);
} }
FromScriptMsg::ChangeRunningAnimationsState(animation_state) => { FromScriptMsg::ChangeRunningAnimationsState(animation_state) => {
@ -1060,58 +1042,47 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// If there is already a pending page (self.pending_changes), it will not be overridden; // If there is already a pending page (self.pending_changes), it will not be overridden;
// However, if the id is not encompassed by another change, it will be. // However, if the id is not encompassed by another change, it will be.
FromScriptMsg::LoadUrl(load_data, replace) => { FromScriptMsg::LoadUrl(load_data, replace) => {
debug!("constellation got URL load message from script");
self.handle_load_url_msg(source_top_ctx_id, source_pipeline_id, load_data, replace); self.handle_load_url_msg(source_top_ctx_id, source_pipeline_id, load_data, replace);
} }
FromScriptMsg::AbortLoadUrl => { FromScriptMsg::AbortLoadUrl => {
debug!("constellation got abort URL load message from script");
self.handle_abort_load_url_msg(source_pipeline_id); self.handle_abort_load_url_msg(source_pipeline_id);
} }
// A page loaded has completed all parsing, script, and reflow messages have been sent. // A page loaded has completed all parsing, script, and reflow messages have been sent.
FromScriptMsg::LoadComplete => { FromScriptMsg::LoadComplete => {
debug!("constellation got load complete message");
self.handle_load_complete_msg(source_top_ctx_id, source_pipeline_id) self.handle_load_complete_msg(source_top_ctx_id, source_pipeline_id)
} }
// Handle a forward or back request // Handle a forward or back request
FromScriptMsg::TraverseHistory(direction) => { FromScriptMsg::TraverseHistory(direction) => {
debug!("constellation got traverse history message from script");
self.handle_traverse_history_msg(source_top_ctx_id, direction); self.handle_traverse_history_msg(source_top_ctx_id, direction);
} }
// Handle a push history state request. // Handle a push history state request.
FromScriptMsg::PushHistoryState(history_state_id, url) => { FromScriptMsg::PushHistoryState(history_state_id, url) => {
debug!("constellation got push history state message from script");
self.handle_push_history_state_msg(source_pipeline_id, history_state_id, url); self.handle_push_history_state_msg(source_pipeline_id, history_state_id, url);
} }
FromScriptMsg::ReplaceHistoryState(history_state_id, url) => { FromScriptMsg::ReplaceHistoryState(history_state_id, url) => {
debug!("constellation got replace history state message from script");
self.handle_replace_history_state_msg(source_pipeline_id, history_state_id, url); self.handle_replace_history_state_msg(source_pipeline_id, history_state_id, url);
} }
// Handle a joint session history length request. // Handle a joint session history length request.
FromScriptMsg::JointSessionHistoryLength(sender) => { FromScriptMsg::JointSessionHistoryLength(sender) => {
debug!("constellation got joint session history length message from script");
self.handle_joint_session_history_length(source_top_ctx_id, sender); self.handle_joint_session_history_length(source_top_ctx_id, sender);
} }
// Notification that the new document is ready to become active // Notification that the new document is ready to become active
FromScriptMsg::ActivateDocument => { FromScriptMsg::ActivateDocument => {
debug!("constellation got activate document message");
self.handle_activate_document_msg(source_pipeline_id); self.handle_activate_document_msg(source_pipeline_id);
} }
// Update pipeline url after redirections // Update pipeline url after redirections
FromScriptMsg::SetFinalUrl(final_url) => { FromScriptMsg::SetFinalUrl(final_url) => {
// The script may have finished loading after we already started shutting down. // The script may have finished loading after we already started shutting down.
if let Some(ref mut pipeline) = self.pipelines.get_mut(&source_pipeline_id) { if let Some(ref mut pipeline) = self.pipelines.get_mut(&source_pipeline_id) {
debug!("constellation got set final url message");
pipeline.url = final_url; pipeline.url = final_url;
} else { } else {
warn!("constellation got set final url message for dead pipeline"); warn!("constellation got set final url message for dead pipeline");
} }
} }
FromScriptMsg::PostMessage(browsing_context_id, origin, data) => { FromScriptMsg::PostMessage(browsing_context_id, origin, data) => {
debug!("constellation got postMessage message");
self.handle_post_message_msg(browsing_context_id, origin, data); self.handle_post_message_msg(browsing_context_id, origin, data);
} }
FromScriptMsg::Focus => { FromScriptMsg::Focus => {
debug!("constellation got focus message");
self.handle_focus_msg(source_pipeline_id); self.handle_focus_msg(source_pipeline_id);
} }
FromScriptMsg::GetClipboardContents(sender) => { FromScriptMsg::GetClipboardContents(sender) => {
@ -1137,57 +1108,45 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
} }
} }
FromScriptMsg::SetVisible(visible) => { FromScriptMsg::SetVisible(visible) => {
debug!("constellation got set visible messsage");
self.handle_set_visible_msg(source_pipeline_id, visible); self.handle_set_visible_msg(source_pipeline_id, visible);
} }
FromScriptMsg::VisibilityChangeComplete(visible) => { FromScriptMsg::VisibilityChangeComplete(visible) => {
debug!("constellation got set visibility change complete message");
self.handle_visibility_change_complete(source_pipeline_id, visible); self.handle_visibility_change_complete(source_pipeline_id, visible);
} }
FromScriptMsg::RemoveIFrame(browsing_context_id, sender) => { FromScriptMsg::RemoveIFrame(browsing_context_id, sender) => {
debug!("constellation got remove iframe message");
let removed_pipeline_ids = self.handle_remove_iframe_msg(browsing_context_id); let removed_pipeline_ids = self.handle_remove_iframe_msg(browsing_context_id);
if let Err(e) = sender.send(removed_pipeline_ids) { if let Err(e) = sender.send(removed_pipeline_ids) {
warn!("Error replying to remove iframe ({})", e); warn!("Error replying to remove iframe ({})", e);
} }
} }
FromScriptMsg::NewFavicon(url) => { FromScriptMsg::NewFavicon(url) => {
debug!("constellation got new favicon message");
if source_is_top_level_pipeline { if source_is_top_level_pipeline {
self.embedder_proxy.send(EmbedderMsg::NewFavicon(source_top_ctx_id, url)); self.embedder_proxy.send(EmbedderMsg::NewFavicon(source_top_ctx_id, url));
} }
} }
FromScriptMsg::HeadParsed => { FromScriptMsg::HeadParsed => {
debug!("constellation got head parsed message");
if source_is_top_level_pipeline { if source_is_top_level_pipeline {
self.embedder_proxy.send(EmbedderMsg::HeadParsed(source_top_ctx_id)); self.embedder_proxy.send(EmbedderMsg::HeadParsed(source_top_ctx_id));
} }
} }
FromScriptMsg::CreateCanvasPaintThread(size, sender) => { FromScriptMsg::CreateCanvasPaintThread(size, sender) => {
debug!("constellation got create-canvas-paint-thread message");
self.handle_create_canvas_paint_thread_msg(&size, sender) self.handle_create_canvas_paint_thread_msg(&size, sender)
} }
FromScriptMsg::NodeStatus(message) => { FromScriptMsg::NodeStatus(message) => {
debug!("constellation got NodeStatus message");
self.embedder_proxy.send(EmbedderMsg::Status(source_top_ctx_id, message)); self.embedder_proxy.send(EmbedderMsg::Status(source_top_ctx_id, message));
} }
FromScriptMsg::SetDocumentState(state) => { FromScriptMsg::SetDocumentState(state) => {
debug!("constellation got SetDocumentState message");
self.document_states.insert(source_pipeline_id, state); self.document_states.insert(source_pipeline_id, state);
} }
FromScriptMsg::Alert(message, sender) => { FromScriptMsg::Alert(message, sender) => {
debug!("constellation got Alert message");
self.handle_alert(source_top_ctx_id, message, sender); self.handle_alert(source_top_ctx_id, message, sender);
} }
FromScriptMsg::MoveTo(point) => { FromScriptMsg::MoveTo(point) => {
self.embedder_proxy.send(EmbedderMsg::MoveTo(source_top_ctx_id, point)); self.embedder_proxy.send(EmbedderMsg::MoveTo(source_top_ctx_id, point));
} }
FromScriptMsg::ResizeTo(size) => { FromScriptMsg::ResizeTo(size) => {
self.embedder_proxy.send(EmbedderMsg::ResizeTo(source_top_ctx_id, size)); self.embedder_proxy.send(EmbedderMsg::ResizeTo(source_top_ctx_id, size));
} }
FromScriptMsg::GetClientWindow(send) => { FromScriptMsg::GetClientWindow(send) => {
self.compositor_proxy.send(ToCompositorMsg::GetClientWindow(send)); self.compositor_proxy.send(ToCompositorMsg::GetClientWindow(send));
} }
@ -1197,25 +1156,21 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
FromScriptMsg::GetScreenAvailSize(send) => { FromScriptMsg::GetScreenAvailSize(send) => {
self.compositor_proxy.send(ToCompositorMsg::GetScreenAvailSize(send)); self.compositor_proxy.send(ToCompositorMsg::GetScreenAvailSize(send));
} }
FromScriptMsg::Exit => { FromScriptMsg::Exit => {
self.compositor_proxy.send(ToCompositorMsg::Exit); self.compositor_proxy.send(ToCompositorMsg::Exit);
} }
FromScriptMsg::LogEntry(thread_name, entry) => { FromScriptMsg::LogEntry(thread_name, entry) => {
self.handle_log_entry(Some(source_top_ctx_id), thread_name, entry); self.handle_log_entry(Some(source_top_ctx_id), thread_name, entry);
} }
FromScriptMsg::SetTitle(title) => { FromScriptMsg::SetTitle(title) => {
if source_is_top_level_pipeline { if source_is_top_level_pipeline {
self.embedder_proxy.send(EmbedderMsg::ChangePageTitle(source_top_ctx_id, title)) self.embedder_proxy.send(EmbedderMsg::ChangePageTitle(source_top_ctx_id, title))
} }
} }
FromScriptMsg::SendKeyEvent(ch, key, key_state, key_modifiers) => { FromScriptMsg::SendKeyEvent(ch, key, key_state, key_modifiers) => {
let event = EmbedderMsg::KeyEvent(Some(source_top_ctx_id), ch, key, key_state, key_modifiers); let event = EmbedderMsg::KeyEvent(Some(source_top_ctx_id), ch, key, key_state, key_modifiers);
self.embedder_proxy.send(event); self.embedder_proxy.send(event);
} }
FromScriptMsg::TouchEventProcessed(result) => { FromScriptMsg::TouchEventProcessed(result) => {
self.compositor_proxy.send(ToCompositorMsg::TouchEventProcessed(result)) self.compositor_proxy.send(ToCompositorMsg::TouchEventProcessed(result))
} }
@ -1241,7 +1196,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
} }
} }
FromScriptMsg::RegisterServiceWorker(scope_things, scope) => { FromScriptMsg::RegisterServiceWorker(scope_things, scope) => {
debug!("constellation got store registration scope message");
self.handle_register_serviceworker(scope_things, scope); self.handle_register_serviceworker(scope_things, scope);
} }
FromScriptMsg::ForwardDOMMessage(msg_vec, scope_url) => { FromScriptMsg::ForwardDOMMessage(msg_vec, scope_url) => {
@ -1258,17 +1212,16 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.embedder_proxy.send(EmbedderMsg::SetFullscreenState(source_top_ctx_id, state)); self.embedder_proxy.send(EmbedderMsg::SetFullscreenState(source_top_ctx_id, state));
} }
FromScriptMsg::ShowIME(kind) => { FromScriptMsg::ShowIME(kind) => {
debug!("constellation got ShowIME message");
self.embedder_proxy.send(EmbedderMsg::ShowIME(source_top_ctx_id, kind)); self.embedder_proxy.send(EmbedderMsg::ShowIME(source_top_ctx_id, kind));
} }
FromScriptMsg::HideIME => { FromScriptMsg::HideIME => {
debug!("constellation got HideIME message");
self.embedder_proxy.send(EmbedderMsg::HideIME(source_top_ctx_id)); self.embedder_proxy.send(EmbedderMsg::HideIME(source_top_ctx_id));
} }
} }
} }
fn handle_request_from_layout(&mut self, message: FromLayoutMsg) { fn handle_request_from_layout(&mut self, message: FromLayoutMsg) {
debug!("Constellation got {:?} message", message);
match message { match message {
FromLayoutMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => { FromLayoutMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
self.handle_change_running_animations_state(pipeline_id, animation_state) self.handle_change_running_animations_state(pipeline_id, animation_state)
@ -1276,18 +1229,15 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
// Layout sends new sizes for all subframes. This needs to be reflected by all // Layout sends new sizes for all subframes. This needs to be reflected by all
// frame trees in the navigation context containing the subframe. // frame trees in the navigation context containing the subframe.
FromLayoutMsg::IFrameSizes(iframe_sizes) => { FromLayoutMsg::IFrameSizes(iframe_sizes) => {
debug!("constellation got iframe size message");
self.handle_iframe_size_msg(iframe_sizes); self.handle_iframe_size_msg(iframe_sizes);
} }
FromLayoutMsg::PendingPaintMetric(pipeline_id, epoch) => { FromLayoutMsg::PendingPaintMetric(pipeline_id, epoch) => {
debug!("constellation got a pending paint metric message");
self.handle_pending_paint_metric(pipeline_id, epoch); self.handle_pending_paint_metric(pipeline_id, epoch);
} }
FromLayoutMsg::SetCursor(cursor) => { FromLayoutMsg::SetCursor(cursor) => {
self.handle_set_cursor_msg(cursor) self.handle_set_cursor_msg(cursor)
} }
FromLayoutMsg::ViewportConstrained(pipeline_id, constraints) => { FromLayoutMsg::ViewportConstrained(pipeline_id, constraints) => {
debug!("constellation got viewport-constrained event message");
self.handle_viewport_constrained_msg(pipeline_id, constraints); self.handle_viewport_constrained_msg(pipeline_id, constraints);
} }
} }

View file

@ -364,7 +364,7 @@ impl fmt::Debug for ConstellationControlMsg {
WebVREvents(..) => "WebVREvents", WebVREvents(..) => "WebVREvents",
PaintMetric(..) => "PaintMetric", PaintMetric(..) => "PaintMetric",
}; };
write!(formatter, "ConstellationMsg::{}", variant) write!(formatter, "ConstellationControlMsg::{}", variant)
} }
} }
@ -710,6 +710,34 @@ pub enum ConstellationMsg {
SetCursor(CursorKind), SetCursor(CursorKind),
} }
impl fmt::Debug for ConstellationMsg {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
use self::ConstellationMsg::*;
let variant = match *self {
Exit => "Exit",
GetBrowsingContext(..) => "GetBrowsingContext",
GetPipeline(..) => "GetPipeline",
GetFocusTopLevelBrowsingContext(..) => "GetFocusTopLevelBrowsingContext",
IsReadyToSaveImage(..) => "IsReadyToSaveImage",
KeyEvent(..) => "KeyEvent",
LoadUrl(..) => "LoadUrl",
TraverseHistory(..) => "TraverseHistory",
WindowSize(..) => "WindowSize",
TickAnimation(..) => "TickAnimation",
WebDriverCommand(..) => "WebDriverCommand",
Reload(..) => "Reload",
LogEntry(..) => "LogEntry",
WebVREvents(..) => "WebVREvents",
NewBrowser(..) => "NewBrowser",
CloseBrowser(..) => "CloseBrowser",
SelectBrowser(..) => "SelectBrowser",
ForwardEvent(..) => "ForwardEvent",
SetCursor(..) => "SetCursor",
};
write!(formatter, "ConstellationMsg::{}", variant)
}
}
/// Resources required by workerglobalscopes /// Resources required by workerglobalscopes
#[derive(Clone, Deserialize, Serialize)] #[derive(Clone, Deserialize, Serialize)]
pub struct WorkerGlobalScopeInit { pub struct WorkerGlobalScopeInit {

View file

@ -22,6 +22,7 @@ use net_traits::request::RequestInit;
use net_traits::storage_thread::StorageType; use net_traits::storage_thread::StorageType;
use servo_url::ImmutableOrigin; use servo_url::ImmutableOrigin;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt;
use style_traits::CSSPixel; use style_traits::CSSPixel;
use style_traits::cursor::CursorKind; use style_traits::cursor::CursorKind;
use style_traits::viewport::ViewportConstraints; use style_traits::viewport::ViewportConstraints;
@ -43,6 +44,20 @@ pub enum LayoutMsg {
ViewportConstrained(PipelineId, ViewportConstraints), ViewportConstrained(PipelineId, ViewportConstraints),
} }
impl fmt::Debug for LayoutMsg {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
use self::LayoutMsg::*;
let variant = match *self {
ChangeRunningAnimationsState(..) => "ChangeRunningAnimationsState",
IFrameSizes(..) => "IFrameSizes",
PendingPaintMetric(..) => "PendingPaintMetric",
SetCursor(..) => "SetCursor",
ViewportConstrained(..) => "ViewportConstrained",
};
write!(formatter, "LayoutMsg::{}", variant)
}
}
/// Whether a DOM event was prevented by web content /// Whether a DOM event was prevented by web content
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum EventResult { pub enum EventResult {
@ -172,6 +187,62 @@ pub enum ScriptMsg {
Exit, Exit,
} }
impl fmt::Debug for ScriptMsg {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
use self::ScriptMsg::*;
let variant = match *self {
InitiateNavigateRequest(..) => "InitiateNavigateRequest",
BroadcastStorageEvent(..) => "BroadcastStorageEvent",
ChangeRunningAnimationsState(..) => "ChangeRunningAnimationsState",
CreateCanvasPaintThread(..) => "CreateCanvasPaintThread",
Focus => "Focus",
GetClipboardContents(..) => "GetClipboardContents",
GetBrowsingContextId(..) => "GetBrowsingContextId",
GetParentInfo(..) => "GetParentInfo",
GetChildBrowsingContextId(..) => "GetChildBrowsingContextId",
HeadParsed => "HeadParsed",
LoadComplete => "LoadComplete",
LoadUrl(..) => "LoadUrl",
AbortLoadUrl => "AbortLoadUrl",
PostMessage(..) => "PostMessage",
TraverseHistory(..) => "TraverseHistory",
PushHistoryState(..) => "PushHistoryState",
ReplaceHistoryState(..) => "ReplaceHistoryState",
JointSessionHistoryLength(..) => "JointSessionHistoryLength",
NewFavicon(..) => "NewFavicon",
NodeStatus(..) => "NodeStatus",
RemoveIFrame(..) => "RemoveIFrame",
SetVisible(..) => "SetVisible",
VisibilityChangeComplete(..) => "VisibilityChangeComplete",
ScriptLoadedURLInIFrame(..) => "ScriptLoadedURLInIFrame",
ScriptNewIFrame(..) => "ScriptNewIFrame",
SetClipboardContents(..) => "SetClipboardContents",
ActivateDocument => "ActivateDocument",
SetDocumentState(..) => "SetDocumentState",
SetFinalUrl(..) => "SetFinalUrl",
Alert(..) => "Alert",
SetTitle(..) => "SetTitle",
SendKeyEvent(..) => "SendKeyEvent",
MoveTo(..) => "MoveTo",
ResizeTo(..) => "ResizeTo",
TouchEventProcessed(..) => "TouchEventProcessed",
LogEntry(..) => "LogEntry",
DiscardDocument => "DiscardDocument",
PipelineExited => "PipelineExited",
ForwardDOMMessage(..) => "ForwardDOMMessage",
RegisterServiceWorker(..) => "RegisterServiceWorker",
SetFullscreenState(..) => "SetFullscreenState",
GetClientWindow(..) => "GetClientWindow",
GetScreenSize(..) => "GetScreenSize",
GetScreenAvailSize(..) => "GetScreenAvailSize",
ShowIME(..) => "ShowIME",
HideIME => "HideIME",
Exit => "Exit",
};
write!(formatter, "ScriptMsg::{}", variant)
}
}
/// Entities required to spawn service workers /// Entities required to spawn service workers
#[derive(Clone, Deserialize, Serialize)] #[derive(Clone, Deserialize, Serialize)]
pub struct ScopeThings { pub struct ScopeThings {