diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-01 18:26:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 18:26:20 -0500 |
commit | 1192aaa14d85f8be2f1ec6a1195755bc308f41ed (patch) | |
tree | 8b91ea5aa070a0665b5322f2c024a415f33adddb /components/layout | |
parent | 070dee354204711eb085159fb9f234e080d181f4 (diff) | |
parent | 09cbe3bce032a965d613a4ae579a02d86a7c9e51 (diff) | |
download | servo-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')
-rw-r--r-- | components/layout/Cargo.toml | 1 | ||||
-rw-r--r-- | components/layout/context.rs | 8 | ||||
-rw-r--r-- | components/layout/lib.rs | 1 |
3 files changed, 5 insertions, 5 deletions
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 6b7dabd9f15..917b6b82e73 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -27,6 +27,7 @@ log = "0.3.5" msg = {path = "../msg"} net_traits = {path = "../net_traits"} ordered-float = "0.2.2" +parking_lot = {version = "0.3.3", features = ["nightly"]} plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} range = {path = "../range"} diff --git a/components/layout/context.rs b/components/layout/context.rs index 17a484e2930..0b3973eac05 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -16,11 +16,12 @@ use ipc_channel::ipc; use net_traits::image::base::Image; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread, ImageResponse, ImageState}; use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder}; +use parking_lot::RwLock; use std::cell::{RefCell, RefMut}; use std::collections::HashMap; use std::hash::BuildHasherDefault; use std::rc::Rc; -use std::sync::{Arc, Mutex, RwLock}; +use std::sync::{Arc, Mutex}; use style::context::{LocalStyleContext, StyleContext, SharedStyleContext}; use url::Url; use util::opts; @@ -194,7 +195,6 @@ impl SharedLayoutContext { -> Option<WebRenderImageInfo> { if let Some(existing_webrender_image) = self.webrender_image_cache .read() - .unwrap() .get(&((*url).clone(), use_placeholder)) { return Some((*existing_webrender_image).clone()) } @@ -205,9 +205,7 @@ impl SharedLayoutContext { if image_info.key.is_none() { Some(image_info) } else { - let mut webrender_image_cache = self.webrender_image_cache - .write() - .unwrap(); + let mut webrender_image_cache = self.webrender_image_cache.write(); webrender_image_cache.insert(((*url).clone(), use_placeholder), image_info); Some(image_info) diff --git a/components/layout/lib.rs b/components/layout/lib.rs index bff6eeca1ac..935a7631e23 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -36,6 +36,7 @@ extern crate log; extern crate msg; extern crate net_traits; extern crate ordered_float; +extern crate parking_lot; #[macro_use] #[no_link] extern crate plugins as servo_plugins; |