aboutsummaryrefslogtreecommitdiffstats
path: root/components/constellation
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2020-05-22 17:49:35 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2020-05-22 21:22:19 +0530
commit39f336b5278fc2c4ab25da508245e8eb86aa9b33 (patch)
treed8939d2b5ae9a3d918148fe1e4dc4afda3f94a54 /components/constellation
parent94063d67a8fb1f4a9f776771aba9eb8a2b3bd3bd (diff)
downloadservo-39f336b5278fc2c4ab25da508245e8eb86aa9b33.tar.gz
servo-39f336b5278fc2c4ab25da508245e8eb86aa9b33.zip
Implement client-side logic for WebGPU id recycling
Diffstat (limited to 'components/constellation')
-rw-r--r--components/constellation/constellation.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 528d3d37fd0..d7408ac549e 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -2209,17 +2209,14 @@ where
Some(bc) => &bc.bc_group_id,
None => return warn!("Browsing context not found"),
};
- let host = match self
- .pipelines
- .get(&source_pipeline_id)
- .map(|pipeline| &pipeline.url)
- {
- Some(ref url) => match reg_host(&url) {
- Some(host) => host,
- None => return warn!("Invalid host url"),
- },
+ let source_pipeline = match self.pipelines.get(&source_pipeline_id) {
+ Some(pipeline) => pipeline,
None => return warn!("ScriptMsg from closed pipeline {:?}.", source_pipeline_id),
};
+ let host = match reg_host(&source_pipeline.url) {
+ Some(host) => host,
+ None => return warn!("Invalid host url"),
+ };
match self
.browsing_context_group_set
.get_mut(&browsing_context_group_id)
@@ -2238,7 +2235,16 @@ where
let send = match browsing_context_group.webgpus.entry(host) {
Entry::Vacant(v) => v
.insert(match WebGPU::new() {
- Some(webgpu) => webgpu,
+ Some(webgpu) => {
+ let msg = ConstellationControlMsg::SetWebGPUPort(webgpu.1);
+ if let Err(e) = source_pipeline.event_loop.send(msg) {
+ warn!(
+ "Failed to send SetWebGPUPort to pipeline {} ({:?})",
+ source_pipeline_id, e
+ );
+ }
+ webgpu.0
+ },
None => return warn!("Failed to create new WebGPU thread"),
})
.0