mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #16282 - upsuper:bug1343964, r=heycam
Move dummy url data to be a static member of URLExtraData This is the Servo side change of [bug 1343964](https://bugzilla.mozilla.org/show_bug.cgi?id=1343964) which has been reviewed on Bugzilla. <!-- 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/16282) <!-- Reviewable:end -->
This commit is contained in:
commit
9ad95a5dc7
7 changed files with 394 additions and 378 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2787,12 +2787,10 @@ dependencies = [
|
|||
"env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
"lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"selectors 0.18.0",
|
||||
"servo_url 0.0.1",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
]
|
||||
|
|
|
@ -444,9 +444,6 @@ extern "C" {
|
|||
url_bytes: *const u8, url_length: u32,
|
||||
media_bytes: *const u8, media_length: u32);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_URLExtraData_CreateDummy() -> *mut RawGeckoURLExtraData;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
|
||||
-> StyleChildrenIteratorOwnedOrNull;
|
||||
|
@ -1859,7 +1856,7 @@ extern "C" {
|
|||
-> ServoComputedValuesStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Initialize();
|
||||
pub fn Servo_Initialize(dummy_url_data: *mut RawGeckoURLExtraData);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Shutdown();
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -100,10 +100,10 @@ use super::stylesheet_loader::StylesheetLoader;
|
|||
|
||||
// A dummy url data for where we don't pass url data in.
|
||||
// We need to get rid of this sooner than later.
|
||||
static mut DUMMY_URL_DATA: Option<*mut URLExtraData> = None;
|
||||
static mut DUMMY_URL_DATA: *mut URLExtraData = 0 as *mut URLExtraData;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Initialize() {
|
||||
pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
|
||||
// Initialize logging.
|
||||
let mut builder = LogBuilder::new();
|
||||
let default_level = if cfg!(debug_assertions) { "warn" } else { "error" };
|
||||
|
@ -122,9 +122,7 @@ pub extern "C" fn Servo_Initialize() {
|
|||
gecko_properties::initialize();
|
||||
|
||||
// Initialize the dummy url data
|
||||
unsafe {
|
||||
DUMMY_URL_DATA = Some(bindings::Gecko_URLExtraData_CreateDummy());
|
||||
}
|
||||
unsafe { DUMMY_URL_DATA = dummy_url_data; }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -132,12 +130,13 @@ pub extern "C" fn Servo_Shutdown() {
|
|||
// Clear some static data to avoid shutdown leaks.
|
||||
gecko_properties::shutdown();
|
||||
|
||||
// Clear the dummy url data to avoid shutdown leaks.
|
||||
unsafe { RefPtr::from_addrefed(DUMMY_URL_DATA.take().unwrap()) };
|
||||
// The dummy url will be released after shutdown, so clear the
|
||||
// reference to avoid use-after-free.
|
||||
unsafe { DUMMY_URL_DATA = ptr::null_mut(); }
|
||||
}
|
||||
|
||||
unsafe fn dummy_url_data() -> &'static RefPtr<URLExtraData> {
|
||||
RefPtr::from_ptr_ref(DUMMY_URL_DATA.as_ref().unwrap())
|
||||
RefPtr::from_ptr_ref(&DUMMY_URL_DATA)
|
||||
}
|
||||
|
||||
fn create_shared_context<'a>(guard: &'a SharedRwLockReadGuard,
|
||||
|
|
|
@ -19,12 +19,10 @@ atomic_refcell = "0.1"
|
|||
cssparser = "0.12"
|
||||
env_logger = "0.4"
|
||||
euclid = "0.11"
|
||||
lazy_static = "0.2"
|
||||
libc = "0.2"
|
||||
log = {version = "0.3.5", features = ["release_max_level_info"]}
|
||||
parking_lot = "0.3"
|
||||
selectors = {path = "../../../components/selectors"}
|
||||
servo_url = {path = "../../../components/url"}
|
||||
style_traits = {path = "../../../components/style_traits"}
|
||||
geckoservo = {path = "../../../ports/geckolib"}
|
||||
style = {path = "../../../components/style", features = ["gecko"]}
|
||||
|
|
|
@ -6,11 +6,9 @@ extern crate atomic_refcell;
|
|||
extern crate cssparser;
|
||||
extern crate env_logger;
|
||||
extern crate geckoservo;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate parking_lot;
|
||||
extern crate selectors;
|
||||
extern crate servo_url;
|
||||
#[macro_use] extern crate style;
|
||||
extern crate style_traits;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue