servo: Merge #17901 - style: Remove now-unused empty Variables struct (from heycam:rm-empty-variables); r=emilio

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

The `Servo_GetEmptyVariables` FFI function no longer has any callers from Gecko, so we can remove it and the code that creates/frees that struct.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./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
- [ ] These changes do not require tests because _____

<!-- 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. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: e95da98f5fae9705131dd0731679241b295095dd

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 477bbed9e1dea773c06fdff4b38af783ae73201b
This commit is contained in:
Cameron McCormack 2017-07-28 09:08:24 -05:00
parent b5035acbc8
commit d9ce239334
4 changed files with 2 additions and 40 deletions

View File

@ -2866,9 +2866,6 @@ extern "C" {
index: u32, name: *mut nsAString)
-> bool;
}
extern "C" {
pub fn Servo_GetEmptyVariables() -> *const nsStyleVariables;
}
extern "C" {
pub fn Gecko_CreateCSSErrorReporter(sheet: *mut ServoStyleSheet,
loader: *mut Loader, uri: *mut nsIURI)

View File

@ -19,13 +19,11 @@ use gecko_bindings::bindings::Gecko_Construct_Default_${style_struct.gecko_ffi_n
use gecko_bindings::bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
use gecko_bindings::bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
% endfor
use gecko_bindings::bindings::Gecko_Construct_nsStyleVariables;
use gecko_bindings::bindings::Gecko_CopyCounterStyle;
use gecko_bindings::bindings::Gecko_CopyCursorArrayFrom;
use gecko_bindings::bindings::Gecko_CopyFontFamilyFrom;
use gecko_bindings::bindings::Gecko_CopyImageValueFrom;
use gecko_bindings::bindings::Gecko_CopyListStyleImageFrom;
use gecko_bindings::bindings::Gecko_Destroy_nsStyleVariables;
use gecko_bindings::bindings::Gecko_EnsureImageLayersLength;
use gecko_bindings::bindings::Gecko_FontFamilyList_AppendGeneric;
use gecko_bindings::bindings::Gecko_FontFamilyList_AppendNamed;
@ -43,7 +41,6 @@ use gecko_bindings::bindings::{Gecko_ResetFilters, Gecko_CopyFiltersFrom};
use gecko_bindings::bindings::RawGeckoPresContextBorrowed;
use gecko_bindings::structs;
use gecko_bindings::structs::nsCSSPropertyID;
use gecko_bindings::structs::nsStyleVariables;
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
use gecko::values::convert_nscolor_to_rgba;
use gecko::values::convert_rgba_to_nscolor;
@ -5030,26 +5027,3 @@ ${impl_style_struct(style_struct)}
<%self:raw_impl_trait style_struct="${style_struct}"></%self:raw_impl_trait>
% endif
% endfor
// This is only accessed from the Gecko main thread.
static mut EMPTY_VARIABLES_STRUCT: Option<nsStyleVariables> = None;
#[no_mangle]
#[allow(non_snake_case)]
pub unsafe extern "C" fn Servo_GetEmptyVariables()
-> *const nsStyleVariables {
EMPTY_VARIABLES_STRUCT.as_ref().unwrap()
}
pub fn initialize() {
unsafe {
EMPTY_VARIABLES_STRUCT = Some(zeroed());
Gecko_Construct_nsStyleVariables(EMPTY_VARIABLES_STRUCT.as_mut().unwrap());
}
}
pub fn shutdown() {
unsafe {
EMPTY_VARIABLES_STRUCT.take().as_mut().map(|v| Gecko_Destroy_nsStyleVariables(v));
}
}

View File

@ -90,7 +90,7 @@ use style::gecko_bindings::structs::nsresult;
use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasFFI, HasArcFFI, HasBoxFFI};
use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
use style::gecko_bindings::sugar::refptr::RefPtr;
use style::gecko_properties::{self, style_structs};
use style::gecko_properties::style_structs;
use style::invalidation::element::restyle_hints::{self, RestyleHint};
use style::media_queries::{MediaList, parse_media_query_list};
use style::parallel;
@ -158,18 +158,12 @@ pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
parser::assert_parsing_mode_match();
traversal_flags::assert_traversal_flags_match();
// Initialize some static data.
gecko_properties::initialize();
// Initialize the dummy url data
unsafe { DUMMY_URL_DATA = dummy_url_data; }
}
#[no_mangle]
pub extern "C" fn Servo_Shutdown() {
// Clear some static data to avoid shutdown leaks.
gecko_properties::shutdown();
// The dummy url will be released after shutdown, so clear the
// reference to avoid use-after-free.
unsafe { DUMMY_URL_DATA = ptr::null_mut(); }

View File

@ -24,10 +24,7 @@ with open(INPUT_FILE, "r") as bindings, open(OUTPUT_FILE, "w+") as tests:
for line in bindings:
match = pattern.search(line)
# GetStyleVariables is a Servo_* function, but temporarily defined on
# the gecko side
if match and match.group(1) != "GetStyleVariables":
if match:
tests.write(TEMPLATE.format(name=match.group(1)))
tests.write("}\n")