Repository navigation
Remove usage of opts::get() from style. - #24500
Conversation
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @asajeffrey (or someone else) soon. |
|
Heads up! This PR modifies the following files:
|
|
sigh. well the build failure is definitely from master, because that's what I was trying to build on the second machine. test-tidy should be fixed now. edit: and since CI handles everything just fine (dunno why my local env isn't working), the main build should now be fixed too. hopefully. |
emilio
left a comment
There was a problem hiding this comment.
This seems ok. @jdm is this the pattern that other code has been following? I guess it does accomplish the "changing opts rebuilds less" bits (assuming we remove the other usage in the crate and the dependency), but the pattern seems somewhat weird.
|
|
||
| /// A global variable holding the state of | ||
| /// `StyleSystemOptions::default().disable_style_sharing_cache`. | ||
| /// This is motivated by [issue #22854](https://github.com/servo/servo/issues/22854). |
There was a problem hiding this comment.
I don't think this line of the comment is useful, it only makes sense in the context of this PR.
There was a problem hiding this comment.
I thought I'd try to leave the issue link for motivation especially because this is an odder pattern than usual, to try and preempt "why not just use opts::get()" for people not familiar with the issue.
There was a problem hiding this comment.
I still think it's not particularly useful. I assume we'd get rid of opts as a dependency of style after changing the other similar uses. Once that's done, if somebody wants to use opts::get() again they need to re-introduce it as a dependency, which makes the consequences of it much more obvious.
Not going to block this patch on removing this comment, but I don't quite see the point of it... Maybe just See #22854 is a good compromise?
Either way this looks ok, mind squashing? Thanks!
There was a problem hiding this comment.
K, I'll do that and squash once I'm at a computer.
|
This is our first time trying this pattern, since we skipped other uses of opts::get inside static functions. I'm in favour. |
|
I just noticed that there's only a single servo/components/style/traversal.rs Lines 48 to 54 in 882dcc8 Would you like me to apply the same pattern here and remove opts from the dependency tree of this crate? |
|
Yes please! |
|
That'd indeed be ideal. Do you plan to do this as part of this PR or a new one? (Just to know if I should submit the current PR as is :)) |
|
I can do that in this PR, but it might take a bit so you can merge if impatient. (I don't mind doing it in a seperate one either, gets me another PR towards hacktoberfest lol, but i'd prefer not to PR spam) |
emilio
left a comment
There was a problem hiding this comment.
Two PRs doing two different things is not spam, in my book ;)
Anyhow, let's submit this. If you get to push your other changes before it lands then it will just not get merged and we'll review those too. Otherwise new PR is fine :)
|
@bors-servo r+ |
|
📌 Commit 0dbcc48 has been approved by |
Remove usage of opts::get() from style::context. <!-- Please describe your changes on the following line: --> Use `AtomicBool`s to create a global storage for a couple of settings used by an implementation of `Default`, suggested in #22854 (comment). I do have one main question: I'm currently setting these statics in `Servo::new()`, would there be a better place to put this? Same goes with making these `pub`, is there a better way to go about this? --- <!-- 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 - Seems to be failing in script for unknown/unrelated reasons, experiencing SIGKILL on two different machines. (May be an issue with the latest commit?) Still works fine on CI though. - [X] `./mach test-tidy` does not report any errors - [X] These changes help with #22854 These changes do not require tests because these are cleanup changes. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
💔 Test failed - status-taskcluster |
|
Uh? I don't think I touched anything related to the tests that changed... Anyway, I'll get rid of the other usage I mentioned earlier now. EDIT: Oh! Would it be better for these statics to be |
Ah, that is a good point... :/ So there's no realistic path to get rid of the dependency for now... Is there any point in removing |
|
There is! I want to split prefs and options into separate crates in the future, so this work is still useful. |
|
@bors-servo r=emilio |
|
📌 Commit b162e9e has been approved by |
Remove usage of opts::get() from style. <!-- Please describe your changes on the following line: --> Use `AtomicBool`s to create a global storage for a couple of settings used by an implementation of `Default`, suggested in #22854 (comment). I do have one main question: I'm currently setting these statics in `Servo::new()`, would there be a better place to put this? Same goes with making these `pub`, is there a better way to go about this? --- <!-- 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 - Seems to be failing in script for unknown/unrelated reasons, experiencing SIGKILL on two different machines. (May be an issue with the latest commit?) Still works fine on CI though. - [X] `./mach test-tidy` does not report any errors - [X] These changes help with #22854 These changes do not require tests because these are cleanup changes. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
💔 Test failed - linux-rel-css |
|
|
facepalm |
|
@bors-servo r+ |
|
📌 Commit 0a07a88 has been approved by |
Remove usage of opts::get() from style. <!-- Please describe your changes on the following line: --> Use `AtomicBool`s to create a global storage for a couple of settings used by an implementation of `Default`, suggested in #22854 (comment). I do have one main question: I'm currently setting these statics in `Servo::new()`, would there be a better place to put this? Same goes with making these `pub`, is there a better way to go about this? --- <!-- 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 - Seems to be failing in script for unknown/unrelated reasons, experiencing SIGKILL on two different machines. (May be an issue with the latest commit?) Still works fine on CI though. - [X] `./mach test-tidy` does not report any errors - [X] These changes help with #22854 These changes do not require tests because these are cleanup changes. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
|
☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster |
Use
AtomicBools to create a global storage for a couple of settings used by an implementation ofDefault, suggested in #22854 (comment).I do have one main question: I'm currently setting these statics in
Servo::new(), would there be a better place to put this? Same goes with making thesepub, is there a better way to go about this?./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThese changes do not require tests because these are cleanup changes.