mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add binding function for cloning DeclarationBlock
This commit is contained in:
parent
e8a3d935ad
commit
f6d5dc7d08
2 changed files with 12 additions and 0 deletions
|
@ -927,6 +927,11 @@ extern "C" {
|
||||||
pub fn Servo_DeclarationBlock_CreateEmpty()
|
pub fn Servo_DeclarationBlock_CreateEmpty()
|
||||||
-> RawServoDeclarationBlockStrong;
|
-> RawServoDeclarationBlockStrong;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn Servo_DeclarationBlock_Clone(declarations:
|
||||||
|
RawServoDeclarationBlockBorrowed)
|
||||||
|
-> RawServoDeclarationBlockStrong;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed,
|
pub fn Servo_DeclarationBlock_Equals(a: RawServoDeclarationBlockBorrowed,
|
||||||
b: RawServoDeclarationBlockBorrowed)
|
b: RawServoDeclarationBlockBorrowed)
|
||||||
|
|
|
@ -426,6 +426,13 @@ pub extern "C" fn Servo_DeclarationBlock_CreateEmpty() -> RawServoDeclarationBlo
|
||||||
Arc::new(RwLock::new(PropertyDeclarationBlock { declarations: vec![], important_count: 0 })).into_strong()
|
Arc::new(RwLock::new(PropertyDeclarationBlock { declarations: vec![], important_count: 0 })).into_strong()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn Servo_DeclarationBlock_Clone(declarations: RawServoDeclarationBlockBorrowed)
|
||||||
|
-> RawServoDeclarationBlockStrong {
|
||||||
|
let declarations = RwLock::<PropertyDeclarationBlock>::as_arc(&declarations);
|
||||||
|
Arc::new(RwLock::new(declarations.read().clone())).into_strong()
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: RawServoDeclarationBlockBorrowed) {
|
pub extern "C" fn Servo_DeclarationBlock_AddRef(declarations: RawServoDeclarationBlockBorrowed) {
|
||||||
unsafe { RwLock::<PropertyDeclarationBlock>::addref(declarations) };
|
unsafe { RwLock::<PropertyDeclarationBlock>::addref(declarations) };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue