aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtbrakhi <atbrakhi@igalia.com>2023-08-15 20:02:02 +0200
committerGitHub <noreply@github.com>2023-08-15 18:02:02 +0000
commit8255e8e31853623b76cec7740c3621a89cfc5fed (patch)
tree0d0f19804d9ee17d5e51b7285fed739a65390a71
parent83a46f68db17de3b84596c4af97e73dbcf7abd6a (diff)
downloadservo-8255e8e31853623b76cec7740c3621a89cfc5fed.tar.gz
servo-8255e8e31853623b76cec7740c3621a89cfc5fed.zip
Remove `EventLoopWaker` from Constellation (#30101)
* remove event_loop_waker that is always None * remove None event_loop_waker form InitialScriptState * fix formatting * remove None event_loop_waker from ScriptThread * remove None EventLoopWaker from Window * remove None and use of wake_after_send in webgl code
-rw-r--r--components/constellation/constellation.rs11
-rw-r--r--components/constellation/pipeline.rs8
-rw-r--r--components/script/dom/webglrenderingcontext.rs43
-rw-r--r--components/script/dom/window.rs13
-rw-r--r--components/script/script_thread.rs7
-rw-r--r--components/script_traits/lib.rs4
-rw-r--r--components/servo/lib.rs7
7 files changed, 15 insertions, 78 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index cf4ca3eb41b..0eb88c42761 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -115,7 +115,7 @@ use devtools_traits::{
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, DevtoolsPageInfo, NavigationState,
ScriptToDevtoolsControlMsg,
};
-use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy, EventLoopWaker};
+use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy};
use embedder_traits::{MediaSessionEvent, MediaSessionPlaybackState};
use euclid::{default::Size2D as UntypedSize2D, Size2D};
use gfx::font_cache_thread::FontCacheThread;
@@ -504,9 +504,6 @@ pub struct Constellation<Message, LTF, STF, SWF> {
/// Application window's GL Context for Media player
player_context: WindowGLContext,
- /// Mechanism to force the compositor to process events.
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
-
/// Pipeline ID of the active media session.
active_media_session: Option<PipelineId>,
@@ -563,9 +560,6 @@ pub struct InitialConstellationState {
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
- /// Mechanism to force the compositor to process events.
- pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
-
/// User agent string to report in network requests.
pub user_agent: Cow<'static, str>,
@@ -827,7 +821,6 @@ where
enable_canvas_antialiasing,
glplayer_threads: state.glplayer_threads,
player_context: state.player_context,
- event_loop_waker: state.event_loop_waker,
active_media_session: None,
user_agent: state.user_agent,
};
@@ -1078,7 +1071,7 @@ where
.map(|threads| threads.pipeline()),
webxr_registry: self.webxr_registry.clone(),
player_context: self.player_context.clone(),
- event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
+ event_loop_waker: None,
user_agent: self.user_agent.clone(),
});
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs
index df05d709924..d536d63bc60 100644
--- a/components/constellation/pipeline.rs
+++ b/components/constellation/pipeline.rs
@@ -327,11 +327,7 @@ impl Pipeline {
let register = state
.background_monitor_register
.expect("Couldn't start content, no background monitor has been initiated");
- unprivileged_pipeline_content.start_all::<Message, LTF, STF>(
- false,
- register,
- state.event_loop_waker,
- );
+ unprivileged_pipeline_content.start_all::<Message, LTF, STF>(false, register);
None
};
@@ -527,7 +523,6 @@ impl UnprivilegedPipelineContent {
self,
wait_for_completion: bool,
background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
) where
LTF: LayoutThreadFactory<Message = Message>,
STF: ScriptThreadFactory<Message = Message>,
@@ -574,7 +569,6 @@ impl UnprivilegedPipelineContent {
webrender_api_sender: self.webrender_api_sender.clone(),
layout_is_busy: layout_thread_busy_flag.clone(),
player_context: self.player_context.clone(),
- event_loop_waker,
inherited_secure_context: self.load_data.inherited_secure_context.clone(),
},
self.load_data.clone(),
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index cedbbd5cc7e..39807da9a81 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -63,7 +63,6 @@ use canvas_traits::webgl::{
YAxisTreatment,
};
use dom_struct::dom_struct;
-use embedder_traits::EventLoopWaker;
use euclid::default::{Point2D, Rect, Size2D};
use ipc_channel::ipc::{self, IpcSharedMemory};
use js::jsapi::{JSContext, JSObject, Type};
@@ -236,10 +235,7 @@ impl WebGLRenderingContext {
let max_vertex_attribs = ctx_data.limits.max_vertex_attribs as usize;
Self {
reflector_: Reflector::new(),
- webgl_sender: WebGLMessageSender::new(
- ctx_data.sender,
- window.get_event_loop_waker(),
- ),
+ webgl_sender: WebGLMessageSender::new(ctx_data.sender),
webrender_image: ctx_data.image_key,
webgl_version,
glsl_version: ctx_data.glsl_version,
@@ -4895,21 +4891,15 @@ pub enum TexSource {
pub struct WebGLCommandSender {
#[no_trace]
sender: WebGLChan,
- #[no_trace]
- waker: Option<Box<dyn EventLoopWaker>>,
}
impl WebGLCommandSender {
- pub fn new(sender: WebGLChan, waker: Option<Box<dyn EventLoopWaker>>) -> WebGLCommandSender {
- WebGLCommandSender { sender, waker }
+ pub fn new(sender: WebGLChan) -> WebGLCommandSender {
+ WebGLCommandSender { sender }
}
pub fn send(&self, msg: WebGLMsg) -> WebGLSendResult {
- let result = self.sender.send(msg);
- if let Some(ref waker) = self.waker {
- waker.wake();
- }
- result
+ self.sender.send(msg)
}
}
@@ -4917,34 +4907,19 @@ impl WebGLCommandSender {
pub(crate) struct WebGLMessageSender {
#[no_trace]
sender: WebGLMsgSender,
- #[ignore_malloc_size_of = "traits are cumbersome"]
- #[no_trace]
- waker: Option<Box<dyn EventLoopWaker>>,
}
impl Clone for WebGLMessageSender {
fn clone(&self) -> WebGLMessageSender {
WebGLMessageSender {
sender: self.sender.clone(),
- waker: self.waker.as_ref().map(|w| (*w).clone_box()),
}
}
}
impl WebGLMessageSender {
- fn wake_after_send<F: FnOnce() -> WebGLSendResult>(&self, f: F) -> WebGLSendResult {
- let result = f();
- if let Some(ref waker) = self.waker {
- waker.wake();
- }
- result
- }
-
- pub fn new(
- sender: WebGLMsgSender,
- waker: Option<Box<dyn EventLoopWaker>>,
- ) -> WebGLMessageSender {
- WebGLMessageSender { sender, waker }
+ pub fn new(sender: WebGLMsgSender) -> WebGLMessageSender {
+ WebGLMessageSender { sender }
}
pub fn context_id(&self) -> WebGLContextId {
@@ -4952,7 +4927,7 @@ impl WebGLMessageSender {
}
pub fn send(&self, msg: WebGLCommand, backtrace: WebGLCommandBacktrace) -> WebGLSendResult {
- self.wake_after_send(|| self.sender.send(msg, backtrace))
+ self.sender.send(msg, backtrace)
}
pub fn send_resize(
@@ -4960,11 +4935,11 @@ impl WebGLMessageSender {
size: Size2D<u32>,
sender: WebGLSender<Result<(), String>>,
) -> WebGLSendResult {
- self.wake_after_send(|| self.sender.send_resize(size, sender))
+ self.sender.send_resize(size, sender)
}
pub fn send_remove(&self) -> WebGLSendResult {
- self.wake_after_send(|| self.sender.send_remove())
+ self.sender.send_remove()
}
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 65dc4118583..4d8bc430ee9 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -371,11 +371,6 @@ pub struct Window {
#[no_trace]
player_context: WindowGLContext,
- /// A mechanism to force the compositor to process events.
- #[ignore_malloc_size_of = "traits are cumbersome"]
- #[no_trace]
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
-
visible: Cell<bool>,
/// A shared marker for the validity of any cached layout values. A value of true
@@ -514,7 +509,7 @@ impl Window {
pub(crate) fn webgl_chan(&self) -> Option<WebGLCommandSender> {
self.webgl_chan
.as_ref()
- .map(|chan| WebGLCommandSender::new(chan.clone(), self.get_event_loop_waker()))
+ .map(|chan| WebGLCommandSender::new(chan.clone()))
}
pub fn webxr_registry(&self) -> webxr_api::Registry {
@@ -570,10 +565,6 @@ impl Window {
self.player_context.clone()
}
- pub fn get_event_loop_waker(&self) -> Option<Box<dyn EventLoopWaker>> {
- self.event_loop_waker.as_ref().map(|w| (*w).clone_box())
- }
-
// see note at https://dom.spec.whatwg.org/#concept-event-dispatch step 2
pub fn dispatch_event_with_target_override(&self, event: &Event) -> EventStatus {
if self.has_document() {
@@ -2587,7 +2578,6 @@ impl Window {
replace_surrogates: bool,
user_agent: Cow<'static, str>,
player_context: WindowGLContext,
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
gpu_id_hub: Arc<ParkMutex<Identities>>,
inherited_secure_context: Option<bool>,
) -> DomRoot<Self> {
@@ -2673,7 +2663,6 @@ impl Window {
userscripts_path,
replace_surrogates,
player_context,
- event_loop_waker,
visible: Cell::new(true),
layout_marker: DomRefCell::new(Rc::new(Cell::new(true))),
current_event: DomRefCell::new(None),
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index b0b55eeb43a..b9833da8e3f 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -715,10 +715,6 @@ pub struct ScriptThread {
#[no_trace]
player_context: WindowGLContext,
- /// A mechanism to force the compositor's event loop to process events.
- #[no_trace]
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
-
/// A set of all nodes ever created in this script thread
node_ids: DomRefCell<HashSet<String>>,
@@ -1416,7 +1412,6 @@ impl ScriptThread {
replace_surrogates: opts.debug.replace_surrogates,
user_agent,
player_context: state.player_context,
- event_loop_waker: state.event_loop_waker,
node_ids: Default::default(),
is_user_interacting: Cell::new(false),
@@ -3295,6 +3290,7 @@ impl ScriptThread {
self.timer_task_source(incomplete.pipeline_id),
self.websocket_task_source(incomplete.pipeline_id),
);
+
// Create the window and document objects.
let window = Window::new(
self.js_runtime.clone(),
@@ -3333,7 +3329,6 @@ impl ScriptThread {
self.replace_surrogates,
self.user_agent.clone(),
self.player_context.clone(),
- self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
self.gpu_id_hub.clone(),
incomplete.inherited_secure_context,
);
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index f85a833df94..a6291cf5745 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -38,7 +38,7 @@ use canvas_traits::webgl::WebGLPipeline;
use compositor::ScrollTreeNodeId;
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
-use embedder_traits::{Cursor, EventLoopWaker};
+use embedder_traits::Cursor;
use euclid::{default::Point2D, Length, Rect, Scale, Size2D, UnknownUnit, Vector2D};
use gfx_traits::Epoch;
use http::HeaderMap;
@@ -687,8 +687,6 @@ pub struct InitialScriptState {
pub layout_is_busy: Arc<AtomicBool>,
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
- /// Mechanism to force the compositor to process events.
- pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
}
/// This trait allows creating a `ScriptThread` without depending on the `script`
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 91a263d450e..e82994e46ff 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -454,8 +454,6 @@ where
webrender.set_external_image_handler(external_image_handlers);
- let event_loop_waker = None;
-
// The division by 1 represents the page's default zoom of 100%,
// and gives us the appropriate CSSPixel type for the viewport.
let window_size = WindowSizeData {
@@ -480,7 +478,6 @@ where
player_context,
Some(webgl_threads),
glplayer_threads,
- event_loop_waker,
window_size,
external_images,
wgpu_image_map,
@@ -851,7 +848,6 @@ fn create_constellation(
player_context: WindowGLContext,
webgl_threads: Option<WebGLThreads>,
glplayer_threads: Option<GLPlayerThreads>,
- event_loop_waker: Option<Box<dyn EventLoopWaker>>,
initial_window_size: WindowSizeData,
external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
wgpu_image_map: Arc<Mutex<HashMap<u64, webgpu::PresentationData>>>,
@@ -899,7 +895,6 @@ fn create_constellation(
webgl_threads,
glplayer_threads,
player_context,
- event_loop_waker,
user_agent,
webrender_external_images: external_images,
wgpu_image_map,
@@ -1046,7 +1041,6 @@ pub fn run_content_process(token: String) {
script::script_thread::ScriptThread>(
true,
background_hang_monitor_register,
- None,
);
} else {
content.start_all::<script_layout_interface::message::Msg,
@@ -1054,7 +1048,6 @@ pub fn run_content_process(token: String) {
script::script_thread::ScriptThread>(
true,
background_hang_monitor_register,
- None,
);
}
},