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
stylo: Destroy static Variables struct on shutdown. #15629
Conversation
Maybe this should be part of GlobalStyleData suggested in #15535? The mutex might be overkill. |
Yeah, maybe. Although this is only temporary until we get around to support CSS Variables properly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with or without that nit.
|
||
pub fn shutdown() { | ||
let mut data = EMPTY_VARIABLES_STRUCT.lock().unwrap(); | ||
if data.is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: You can use .take()
instead, and remove the *data = None
.
variables | ||
} | ||
}; | ||
static ref EMPTY_VARIABLES_STRUCT: Mutex<Option<nsStyleVariables>> = Mutex::new(None); | ||
} | ||
|
||
#[no_mangle] | ||
#[allow(non_snake_case)] | ||
pub unsafe extern "C" fn Servo_GetStyleVariables(_cv: ServoComputedValuesBorrowedOrNull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd bet that we implemented this in C++? huh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to be, but we moved it over here when we had some linking issues in non-MOZ_STYLO builds.
I agree it'd be ok to make this more generic and not require a Mutex, but since it's only temporary I'd say that keeping CI green is more prioritary. |
☔ The latest upstream changes (presumably #15627) made this pull request unmergeable. Please resolve the merge conflicts. |
62cc1b1
to
82a6060
Compare
82a6060
to
58fcd51
Compare
I got rid of the Mutex, just to avoid it potentially showing up in profiles. re-r? @emilio |
}; | ||
} | ||
// This is only accessed from the Gecko main thread. | ||
static mut EMPTY_VARIABLES_STRUCT: Option<nsStyleVariables> = None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this works because nsStyleVariables doesn't have a Drop impl, only the wrapper struct.
Still think we'll eventually want some unified system (GlobalStyleData) but this is fine for now. @bors-servo delegate+ |
✌️ @heycam can now approve this pull request |
@bors-servo r=bholley,emilio |
📌 Commit 58fcd51 has been approved by |
⌛ Testing commit 58fcd51 with merge eec8823... |
💔 Test failed - linux-rel-wpt |
stylo: Destroy static Variables struct on shutdown. Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1340457. r? @emilio <!-- 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/15629) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1340457.
r? @emilio
This change is