aboutsummaryrefslogtreecommitdiffstats
path: root/components/constellation
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-03-08 10:46:52 -0500
committerGitHub <noreply@github.com>2019-03-08 10:46:52 -0500
commit34a5a824b8635d918425080dc54397671f4212a7 (patch)
tree8a924773873247c89b0d4e90d5e917cb9ad1329b /components/constellation
parenta0a977cee8d33fdf2bccd62e878b36fa8b82e007 (diff)
parent056edbbd15fb2a6f7763b70c6e61ca57ca3a515c (diff)
downloadservo-34a5a824b8635d918425080dc54397671f4212a7.tar.gz
servo-34a5a824b8635d918425080dc54397671f4212a7.zip
Auto merge of #23000 - jdm:invisible-webgl, r=nox
Make webgl behave better with session history This prevents the compositor from animating pages that are not actually visible, so pages using webgl do not needlessly impact the performance of the rest of the browser. Additionally, this fixes a problem that was alluded to in [this code](https://github.com/servo/rust-offscreen-rendering-context/blob/b5228c098b889a9806a5f93582903e192b3939ef/src/draw_buffer.rs#L282-L285), causing Servo to delete arbitrary resources when a GC occurred in content that used three.js. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22987 and fix #22977 and fix #20934 and fix #20953 and fix #20930 and fix #20950 and fix #20924 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23000) <!-- Reviewable:end -->
Diffstat (limited to 'components/constellation')
-rw-r--r--components/constellation/constellation.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 02c4f757875..076204cd0c7 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -2694,6 +2694,13 @@ where
},
};
+ if let Some(old_pipeline) = self.pipelines.get(&old_pipeline_id) {
+ old_pipeline.notify_visibility(false);
+ }
+ if let Some(new_pipeline) = self.pipelines.get(&new_pipeline_id) {
+ new_pipeline.notify_visibility(true);
+ }
+
self.update_activity(old_pipeline_id);
self.update_activity(new_pipeline_id);
@@ -3413,6 +3420,10 @@ where
self.notify_history_changed(change.top_level_browsing_context_id);
},
Some(old_pipeline_id) => {
+ if let Some(pipeline) = self.pipelines.get(&old_pipeline_id) {
+ pipeline.notify_visibility(false);
+ }
+
// https://html.spec.whatwg.org/multipage/#unload-a-document
self.unload_document(old_pipeline_id);
// Deactivate the old pipeline, and activate the new one.