aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2024-03-22 02:48:17 +0800
committerGitHub <noreply@github.com>2024-03-21 18:48:17 +0000
commit0b863de8468ad2526bd9131243fd18cb3ba8b100 (patch)
treec488b4eaf49eb25035209cff4425230cc50c4d13 /components
parent49c6f9e463582c8687a9e3674db7fac740bdad68 (diff)
downloadservo-0b863de8468ad2526bd9131243fd18cb3ba8b100.tar.gz
servo-0b863de8468ad2526bd9131243fd18cb3ba8b100.zip
Rework “visible” to “throttled” in embedder-to-constellation + jniapi (#31815)
Diffstat (limited to 'components')
-rw-r--r--components/compositing/windowing.rs6
-rw-r--r--components/constellation/constellation.rs4
-rw-r--r--components/constellation/tracing.rs2
-rw-r--r--components/servo/lib.rs6
-rw-r--r--components/shared/compositing/constellation_msg.rs6
5 files changed, 12 insertions, 12 deletions
diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs
index 0302eef2911..ef3e0450487 100644
--- a/components/compositing/windowing.rs
+++ b/components/compositing/windowing.rs
@@ -103,8 +103,8 @@ pub enum EmbedderEvent {
/// Sent when the user triggers a media action through the UA exposed media UI
/// (play, pause, seek, etc.).
MediaSessionAction(MediaSessionActionType),
- /// The visibility of the webview has changed.
- WebViewVisibilityChanged(TopLevelBrowsingContextId, bool),
+ /// Set whether to use less resources, by stopping animations and running timers at a heavily limited rate.
+ SetWebViewThrottled(TopLevelBrowsingContextId, bool),
/// Virtual keyboard was dismissed
IMEDismissed,
/// Sent on platforms like Android where the native widget surface can be
@@ -148,7 +148,7 @@ impl Debug for EmbedderEvent {
EmbedderEvent::ToggleSamplingProfiler(..) => write!(f, "ToggleSamplingProfiler"),
EmbedderEvent::ExitFullScreen(..) => write!(f, "ExitFullScreen"),
EmbedderEvent::MediaSessionAction(..) => write!(f, "MediaSessionAction"),
- EmbedderEvent::WebViewVisibilityChanged(..) => write!(f, "WebViewVisibilityChanged"),
+ EmbedderEvent::SetWebViewThrottled(..) => write!(f, "SetWebViewThrottled"),
EmbedderEvent::IMEDismissed => write!(f, "IMEDismissed"),
EmbedderEvent::ClearCache => write!(f, "ClearCache"),
EmbedderEvent::InvalidateNativeSurface => write!(f, "InvalidateNativeSurface"),
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 1e3717b4a89..c550c2b2c4d 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -1535,8 +1535,8 @@ where
FromCompositorMsg::MediaSessionAction(action) => {
self.handle_media_session_action_msg(action);
},
- FromCompositorMsg::WebViewVisibilityChanged(webview_id, visible) => {
- self.notify_webview_visibility(webview_id, visible);
+ FromCompositorMsg::SetWebViewThrottled(webview_id, throttled) => {
+ self.notify_webview_visibility(webview_id, !throttled);
},
FromCompositorMsg::ReadyToPresent(top_level_browsing_context_id) => {
self.embedder_proxy.send((
diff --git a/components/constellation/tracing.rs b/components/constellation/tracing.rs
index 9c2cb995610..fe388c95ab1 100644
--- a/components/constellation/tracing.rs
+++ b/components/constellation/tracing.rs
@@ -86,7 +86,7 @@ mod from_compositor {
Self::DisableProfiler => target!("DisableProfiler"),
Self::ExitFullScreen(_) => target!("ExitFullScreen"),
Self::MediaSessionAction(_) => target!("MediaSessionAction"),
- Self::WebViewVisibilityChanged(_, _) => target!("WebViewVisibilityChanged"),
+ Self::SetWebViewThrottled(_, _) => target!("SetWebViewThrottled"),
Self::IMEDismissed => target!("IMEDismissed"),
Self::ReadyToPresent(_) => target!("ReadyToPresent"),
Self::Gamepad(_) => target!("Gamepad"),
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 730b52c6f96..038560338b0 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -783,11 +783,11 @@ where
}
},
- EmbedderEvent::WebViewVisibilityChanged(webview_id, visible) => {
- let msg = ConstellationMsg::WebViewVisibilityChanged(webview_id, visible);
+ EmbedderEvent::SetWebViewThrottled(webview_id, throttled) => {
+ let msg = ConstellationMsg::SetWebViewThrottled(webview_id, throttled);
if let Err(e) = self.constellation_chan.send(msg) {
warn!(
- "Sending WebViewVisibilityChanged to constellation failed ({:?}).",
+ "Sending SetWebViewThrottled to constellation failed ({:?}).",
e
);
}
diff --git a/components/shared/compositing/constellation_msg.rs b/components/shared/compositing/constellation_msg.rs
index 263d0f510a8..8204ec6d2e3 100644
--- a/components/shared/compositing/constellation_msg.rs
+++ b/components/shared/compositing/constellation_msg.rs
@@ -76,8 +76,8 @@ pub enum ConstellationMsg {
ExitFullScreen(TopLevelBrowsingContextId),
/// Media session action.
MediaSessionAction(MediaSessionActionType),
- /// The visibility of the webview has changed.
- WebViewVisibilityChanged(TopLevelBrowsingContextId, bool),
+ /// Set whether to use less resources, by stopping animations and running timers at a heavily limited rate.
+ SetWebViewThrottled(TopLevelBrowsingContextId, bool),
/// Virtual keyboard was dismissed
IMEDismissed,
/// Compositing done, but external code needs to present.
@@ -115,7 +115,7 @@ impl fmt::Debug for ConstellationMsg {
DisableProfiler => "DisableProfiler",
ExitFullScreen(..) => "ExitFullScreen",
MediaSessionAction(..) => "MediaSessionAction",
- WebViewVisibilityChanged(..) => "WebViewVisibilityChanged",
+ SetWebViewThrottled(..) => "SetWebViewThrottled",
IMEDismissed => "IMEDismissed",
ClearCache => "ClearCache",
ReadyToPresent(..) => "ReadyToPresent",