Auto merge of #15682 - upsuper:arc-types, r=Manishearth

Simplify defining arc ffi types

r? @Manishearth

I don't have a good sense for creating syntax... so if you have any suggestion for the syntax of `impl_arc_ffi` macro, it would be appreciated.

<!-- 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/15682)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-22 15:58:35 -08:00 committed by GitHub
commit af292c4a71
6 changed files with 61 additions and 118 deletions

View file

@ -332,17 +332,6 @@ pub extern "C" fn Servo_AnimationValues_Populate(anim: RawGeckoAnimationValueLis
}
}
#[no_mangle]
pub extern "C" fn Servo_AnimationValue_AddRef(anim: RawServoAnimationValueBorrowed) -> () {
unsafe { AnimationValue::addref(anim) };
}
#[no_mangle]
pub extern "C" fn Servo_AnimationValue_Release(anim: RawServoAnimationValueBorrowed) -> () {
unsafe { AnimationValue::release(anim) };
}
#[no_mangle]
pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 {
*NUM_THREADS as u32
@ -530,16 +519,6 @@ pub extern "C" fn Servo_StyleSheet_GetRules(sheet: RawServoStyleSheetBorrowed) -
Stylesheet::as_arc(&sheet).rules.clone().into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_AddRef(sheet: RawServoStyleSheetBorrowed) -> () {
unsafe { Stylesheet::addref(sheet) };
}
#[no_mangle]
pub extern "C" fn Servo_StyleSheet_Release(sheet: RawServoStyleSheetBorrowed) -> () {
unsafe { Stylesheet::release(sheet) };
}
#[no_mangle]
pub extern "C" fn Servo_CssRules_ListTypes(rules: ServoCssRulesBorrowed,
result: nsTArrayBorrowed_uintptr_t) -> () {
@ -588,26 +567,6 @@ pub extern "C" fn Servo_CssRules_DeleteRule(rules: ServoCssRulesBorrowed, index:
}
}
#[no_mangle]
pub extern "C" fn Servo_CssRules_AddRef(rules: ServoCssRulesBorrowed) -> () {
unsafe { RwLock::<CssRules>::addref(rules) };
}
#[no_mangle]
pub extern "C" fn Servo_CssRules_Release(rules: ServoCssRulesBorrowed) -> () {
unsafe { RwLock::<CssRules>::release(rules) };
}
#[no_mangle]
pub extern "C" fn Servo_StyleRule_AddRef(rule: RawServoStyleRuleBorrowed) -> () {
unsafe { RwLock::<StyleRule>::addref(rule) };
}
#[no_mangle]
pub extern "C" fn Servo_StyleRule_Release(rule: RawServoStyleRuleBorrowed) -> () {
unsafe { RwLock::<StyleRule>::release(rule) };
}
#[no_mangle]
pub extern "C" fn Servo_StyleRule_Debug(rule: RawServoStyleRuleBorrowed, result: *mut nsACString) -> () {
let rule = RwLock::<StyleRule>::as_arc(&rule);
@ -641,16 +600,6 @@ pub extern "C" fn Servo_StyleRule_GetSelectorText(rule: RawServoStyleRuleBorrowe
rule.read().selectors.to_css(unsafe { result.as_mut().unwrap() }).unwrap();
}
#[no_mangle]
pub extern "C" fn Servo_ImportRule_AddRef(rule: RawServoImportRuleBorrowed) -> () {
unsafe { RwLock::<ImportRule>::addref(rule) };
}
#[no_mangle]
pub extern "C" fn Servo_ImportRule_Release(rule: RawServoImportRuleBorrowed) -> () {
unsafe { RwLock::<ImportRule>::release(rule) };
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoComputedValuesBorrowedOrNull,
pseudo_tag: *mut nsIAtom,
@ -727,16 +676,6 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
style.into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesBorrowed) {
unsafe { ComputedValues::addref(ptr) };
}
#[no_mangle]
pub extern "C" fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed) {
unsafe { ComputedValues::release(ptr) };
}
/// See the comment in `Device` to see why it's ok to pass an owned reference to
/// the pres context (hint: the context outlives the StyleSet, that holds the
/// device alive).
@ -814,16 +753,6 @@ pub extern "C" fn Servo_DeclarationBlock_Clone(declarations: RawServoDeclaration
Arc::new(RwLock::new(declarations.read().clone())).into_strong()
}
#[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: RawServoDeclarationBlockBorrowed) {
unsafe { RwLock::<PropertyDeclarationBlock>::addref(declarations) };
}
#[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_Release(declarations: RawServoDeclarationBlockBorrowed) {
unsafe { RwLock::<PropertyDeclarationBlock>::release(declarations) };
}
#[no_mangle]
pub extern "C" fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed,
b: RawServoDeclarationBlockBorrowed)