diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-03-18 00:47:08 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-03-19 22:30:37 +0100 |
commit | aeffca2a5900ebcf91063e9c7771b642817cb6bd (patch) | |
tree | 35a2a3513088fa303d96ed522d5c12eb29d6518c /components/style/shared_lock.rs | |
parent | 57724e5a3755a757e502658094dfda171c78ba78 (diff) | |
download | servo-aeffca2a5900ebcf91063e9c7771b642817cb6bd.tar.gz servo-aeffca2a5900ebcf91063e9c7771b642817cb6bd.zip |
Replace RwLock<StyleRule> with Locked<StyleRule>
Diffstat (limited to 'components/style/shared_lock.rs')
-rw-r--r-- | components/style/shared_lock.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/style/shared_lock.rs b/components/style/shared_lock.rs index d4d66b8fc5d..c92ab9efccf 100644 --- a/components/style/shared_lock.rs +++ b/components/style/shared_lock.rs @@ -177,3 +177,23 @@ pub trait ToCssWithGuard { s } } + +/// Guards for a document +#[derive(Clone)] +pub struct ReadGuards<'a> { + /// For author-origin stylesheets + pub author: &'a SharedRwLockReadGuard<'a>, + + /// For user-agent-origin and user-origin stylesheets + pub ua_or_user: &'a SharedRwLockReadGuard<'a>, +} + +impl<'a> ReadGuards<'a> { + /// Same guard for all origins + pub fn same(guard: &'a SharedRwLockReadGuard<'a>) -> Self { + ReadGuards { + author: guard, + ua_or_user: guard, + } + } +} |