Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parking_lot::RwLock for PropertyDeclarationBlock #13459

Merged
merged 9 commits into from
Oct 4, 2016

Conversation

SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Sep 27, 2016

As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1305141

Closes #13176


Original PR title: Stop relying on impl<T: HeapSizeOf> HeapSizeOf for Arc<T>
servo/heapsize#37 (comment)

This builds on top of that.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because refactor

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/Cargo.toml, components/style/restyle_hints.rs, components/style/properties/properties.mako.rs, components/style/selector_matching.rs, components/style/stylesheets.rs, components/style/keyframes.rs
  • @KiChjang: components/script/dom/document.rs, components/script/dom/htmllinkelement.rs, components/script/dom/element.rs, components/script/dom/htmlstyleelement.rs, components/script/Cargo.toml, components/script/dom/workerglobalscope.rs, components/script/dom/htmlmetaelement.rs, components/script/dom/htmlimageelement.rs, components/script_layout_interface/Cargo.toml, components/script/dom/htmlobjectelement.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 27, 2016
@SimonSapin SimonSapin changed the title Make style build without impl<T: HeapSizeOf> HeapSizeOf for Arc<T>. Stop relying on impl<T: HeapSizeOf> HeapSizeOf for Arc<T>. Sep 27, 2016
@nox
Copy link
Contributor

nox commented Sep 27, 2016

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit a710b40 has been approved by nox

@highfive highfive assigned nox and unassigned KiChjang Sep 27, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 27, 2016
@nox
Copy link
Contributor

nox commented Sep 28, 2016

Reviewed 3 of 3 files at r1, 12 of 12 files at r2, 8 of 8 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 28, 2016
@SimonSapin SimonSapin changed the title Stop relying on impl<T: HeapSizeOf> HeapSizeOf for Arc<T>. Use parking_lot::RwLock for PropertyDeclarationBlock Sep 28, 2016
Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this. In general, I'd like us to ensure we don't block in most cases (it should only be needed for keyframes), but I see why that's hard. It can become a followup. In any case it's better than the YOLO RefCell we have now.

@@ -119,43 +118,42 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {

// Step 2
if let Some(shorthand) = Shorthand::from_name(&property) {
let style_attribute = owner.style_attribute().borrow();
let style_attribute = if let Some(ref style_attribute) = *style_attribute {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be easier to read with a match instead?

@SimonSapin
Copy link
Member Author

@bors-servo r=emilio p=10

(Prioritized as this is prone to bitrot.)

@bors-servo
Copy link
Contributor

📌 Commit d6538f9 has been approved by emilio

@highfive highfive assigned emilio and unassigned nox Sep 28, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Sep 28, 2016
@bors-servo
Copy link
Contributor

⌛ Testing commit d6538f9 with merge 0e870bf...

bors-servo pushed a commit that referenced this pull request Sep 28, 2016
Use parking_lot::RwLock for PropertyDeclarationBlock

<!-- Please describe your changes on the following line: -->

As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1305141

Closes #13176

---

Original PR title: Stop relying on `impl<T: HeapSizeOf> HeapSizeOf for Arc<T>`
servo/heapsize#37 (comment)

This builds on top of that.

---
<!-- 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
- [x] These changes do not require tests because refactor

<!-- 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/13459)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 28, 2016
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Sep 28, 2016
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Oct 4, 2016
@SimonSapin
Copy link
Member Author

Rebased and added a "Disable applicable declarations cache for elements with a style attribute" commit.

We’ll need to do something (maybe mark the cache as dirty whenever a PropertyDeclarationBlock is mutated?) when more of CSSOM is implemented, but in the meantime I’d like to land this before it bit-rots again.

re-r? @emilio

@@ -502,7 +502,8 @@ trait PrivateMatchMethods: TNode {
-> Arc<ComputedValues>
where Ctx: StyleContext<'a>
{
let mut cacheable = true;
let has_style_attribute = self.as_element().map_or(false, |e| e.style_attribute().is_some());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here about why we need to do that? Something like the commit message might work. I think the consequences of removing are non-trivial enough that it deserves it.

This commit is r=me with that.

@emilio
Copy link
Member

emilio commented Oct 4, 2016

Also, I think this is the only not-previously-reviewed commit, so feel free to r=me the whole PR when that comment is added.

@bors-servo: try

@bors-servo
Copy link
Contributor

⌛ Trying commit 3d1a917 with merge fc84d1e...

bors-servo pushed a commit that referenced this pull request Oct 4, 2016
Use parking_lot::RwLock for PropertyDeclarationBlock

<!-- Please describe your changes on the following line: -->

As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1305141

Closes #13176

---

Original PR title: Stop relying on `impl<T: HeapSizeOf> HeapSizeOf for Arc<T>`
servo/heapsize#37 (comment)

This builds on top of that.

---
<!-- 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
- [x] These changes do not require tests because refactor

<!-- 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/13459)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

…bute.

The cache is never effective in this case since a style attribute
adds to the set of applicable declarations.

This also avoid avoids the cache giving out-dated (incorrect) results
when `PropertyDeclarationBlock` becomes mutable in a later commit.
This is sufficient for now since CSSOM is only implemented for
`Element.style`. When StyleRule mutation is added,
some additional mechanism (such as evicting the cache) will be needed.
We’re not using it in style after all.
@SimonSapin
Copy link
Member Author

SimonSapin commented Oct 4, 2016

Yes, that was the only new significant change.

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

📌 Commit d15ac9b has been approved by emilio

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 4, 2016
@bors-servo
Copy link
Contributor

💡 This pull request was already approved, no need to approve it again.

@bors-servo
Copy link
Contributor

📌 Commit d15ac9b has been approved by emilio

@bors-servo
Copy link
Contributor

⌛ Testing commit d15ac9b with merge aea9545...

bors-servo pushed a commit that referenced this pull request Oct 4, 2016
Use parking_lot::RwLock for PropertyDeclarationBlock

<!-- Please describe your changes on the following line: -->

As discussed in https://bugzilla.mozilla.org/show_bug.cgi?id=1305141

Closes #13176

---

Original PR title: Stop relying on `impl<T: HeapSizeOf> HeapSizeOf for Arc<T>`
servo/heapsize#37 (comment)

This builds on top of that.

---
<!-- 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
- [x] These changes do not require tests because refactor

<!-- 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/13459)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

@bors-servo bors-servo merged commit d15ac9b into master Oct 4, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 4, 2016
@SimonSapin SimonSapin deleted the no-arc-heapsize branch October 4, 2016 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants