Explicitly allocate and deallocate our initial computed values.

This allows us to trigger style struct destructors before Gecko's leak checking
runs.
This commit is contained in:
Bobby Holley 2016-08-02 22:03:15 -07:00
parent 9b92d0bc3a
commit f0f39904a2
3 changed files with 35 additions and 12 deletions

View file

@ -368,6 +368,7 @@ extern "C" {
pub fn Servo_AddRefComputedValues(arg1: *mut ServoComputedValues);
pub fn Servo_ReleaseComputedValues(arg1: *mut ServoComputedValues);
pub fn Servo_Initialize();
pub fn Servo_Shutdown();
pub fn Servo_RestyleDocument(doc: *mut RawGeckoDocument,
set: *mut RawServoStyleSet);
pub fn Servo_RestyleSubtree(node: *mut RawGeckoNode,

View file

@ -76,6 +76,15 @@ pub extern "C" fn Servo_Initialize() -> () {
//
// See https://doc.rust-lang.org/log/env_logger/index.html for instructions.
env_logger::init().unwrap();
// Allocate our default computed values.
unsafe { ComputedValues::initialize(); }
}
#[no_mangle]
pub extern "C" fn Servo_Shutdown() -> () {
// Destroy our default computed values.
unsafe { ComputedValues::shutdown(); }
}
fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {