aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/proxies.rs
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2025-02-05 18:08:40 +0800
committerGitHub <noreply@github.com>2025-02-05 10:08:40 +0000
commit175f28866dc254a98c4a911eb38ed9b200fdc6d1 (patch)
treee5f89c66cd473e9ed76c66a057e4bc3cc5451fb0 /components/servo/proxies.rs
parent789736590b0dd0806bffeb279f9a9bda9ede0dfc (diff)
downloadservo-175f28866dc254a98c4a911eb38ed9b200fdc6d1.tar.gz
servo-175f28866dc254a98c4a911eb38ed9b200fdc6d1.zip
libservo: Add WebViewDelegate and ServoDelegate and port `winit_minimal` (#35196)
This change adds the second major part of the new API: delegates which have methods called by the Servo loop. When a delegate is set on a `WebView` or on `Servo` itself, the event loop will call into appropriate delegate methods. Applications can implement the delegate on their own structs to add special behavior per-`WebView` or for all `WebView`s. In addition, each delegate has a default implementation, which automatically exposes "reasonable" behavior such as by-default allowing navigation. There's a lot more work to do here, such as refining the delegate methods so that they all have nice interfaces, particulary with regard to delegate methods that need an asynchronous response. This will be handed gradually as we keep working on the API. Signed-off-by: Delan Azabani <dazabani@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/servo/proxies.rs')
-rw-r--r--components/servo/proxies.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/servo/proxies.rs b/components/servo/proxies.rs
index 526eeea21f3..248e1e66f66 100644
--- a/components/servo/proxies.rs
+++ b/components/servo/proxies.rs
@@ -23,6 +23,10 @@ impl ConstellationProxy {
}
}
+ pub fn disconnected(&self) -> bool {
+ self.disconnected.load(Ordering::SeqCst)
+ }
+
pub fn send(&self, msg: ConstellationMsg) {
if self.try_send(msg).is_err() {
warn!("Lost connection to Constellation. Will report to embedder.")
@@ -30,7 +34,7 @@ impl ConstellationProxy {
}
pub fn try_send(&self, msg: ConstellationMsg) -> Result<(), SendError<ConstellationMsg>> {
- if self.disconnected.load(Ordering::SeqCst) {
+ if self.disconnected() {
return Err(SendError(msg));
}
if let Err(error) = self.sender.send(msg) {