Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstylo: Destroy static Variables struct on shutdown. #15629
Conversation
highfive
commented
Feb 18, 2017
highfive
commented
Feb 18, 2017
|
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. |
|
r=me with or without that nit. |
|
|
||
| pub fn shutdown() { | ||
| let mut data = EMPTY_VARIABLES_STRUCT.lock().unwrap(); | ||
| if data.is_some() { |
This comment has been minimized.
This comment has been minimized.
| 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) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
heycam
Feb 19, 2017
Author
Member
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. |
|
|
62cc1b1
to
82a6060
|
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; |
This comment has been minimized.
This comment has been minimized.
bholley
Feb 19, 2017
Contributor
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+ |
|
|
|
@bors-servo r=bholley,emilio |
|
|
|
|
|
|
|
@bors-servo retry |
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 -->
|
|
heycam commentedFeb 18, 2017
•
edited by larsbergstrom
Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1340457.
r? @emilio
This change is