aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-01 18:26:20 -0500
committerGitHub <noreply@github.com>2016-11-01 18:26:20 -0500
commit1192aaa14d85f8be2f1ec6a1195755bc308f41ed (patch)
tree8b91ea5aa070a0665b5322f2c024a415f33adddb /components/layout_thread/lib.rs
parent070dee354204711eb085159fb9f234e080d181f4 (diff)
parent09cbe3bce032a965d613a4ae579a02d86a7c9e51 (diff)
downloadservo-1192aaa14d85f8be2f1ec6a1195755bc308f41ed.tar.gz
servo-1192aaa14d85f8be2f1ec6a1195755bc308f41ed.zip
Auto merge of #14008 - upsuper:rwlock, r=SimonSapin
Make style::context use parking_lot::RwLock <!-- Please describe your changes on the following line: --> The main motivation is to use `parking_lot::RwLock` instead of `sync::RwLock` in `style::context`, so that we can make `Stylesheet` be hold in a `parking_lot::RwLock` like other structs used for geckolib. r? @SimonSapin --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14008) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 8016bb68b44..32231f1808b 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -32,6 +32,7 @@ extern crate lazy_static;
extern crate log;
extern crate msg;
extern crate net_traits;
+extern crate parking_lot;
#[macro_use]
extern crate profile_traits;
extern crate script;
@@ -83,6 +84,7 @@ use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::PipelineId;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
use net_traits::image_cache_thread::UsePlaceholder;
+use parking_lot::RwLock;
use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
use profile_traits::time::{self, TimerMetadata, profile};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
@@ -101,7 +103,7 @@ use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use std::ops::{Deref, DerefMut};
use std::process;
-use std::sync::{Arc, Mutex, MutexGuard, RwLock};
+use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
use style::animation::Animation;
@@ -1316,7 +1318,7 @@ impl LayoutThread {
if let Some(mut root_flow) = self.root_flow.clone() {
// Perform an abbreviated style recalc that operates without access to the DOM.
- let animations = self.running_animations.read().unwrap();
+ let animations = self.running_animations.read();
profile(time::ProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(),
self.time_profiler_chan.clone(),
@@ -1368,8 +1370,8 @@ impl LayoutThread {
// Kick off animations if any were triggered, expire completed ones.
animation::update_animation_state(&self.constellation_chan,
&self.script_chan,
- &mut *self.running_animations.write().unwrap(),
- &mut *self.expired_animations.write().unwrap(),
+ &mut *self.running_animations.write(),
+ &mut *self.expired_animations.write(),
&self.new_animations_receiver,
self.id,
&self.timer);