Use the new struct in stylo.

This commit is contained in:
Xidorn Quan 2017-05-24 15:53:31 +10:00
parent f3a694a7b4
commit 737733eaae
2 changed files with 36 additions and 19 deletions

View file

@ -13,6 +13,13 @@ impl<T> nsCOMPtr<T> {
pub fn raw<U>(&self) -> *mut T {
self.mRawPtr
}
/// Set this pointer from an addrefed raw pointer.
/// It leaks the old pointer.
#[inline]
pub unsafe fn set_raw_from_addrefed<U>(&mut self, ptr: *mut T) {
self.mRawPtr = ptr;
}
}
#[cfg(not(feature = "gecko_debug"))]
@ -22,4 +29,11 @@ impl nsCOMPtr {
pub fn raw<T>(&self) -> *mut T {
self._base.mRawPtr as *mut _
}
/// Set this pointer from an addrefed raw pointer.
/// It leaks the old pointer.
#[inline]
pub unsafe fn set_raw_from_addrefed<T>(&mut self, ptr: *mut T) {
self._base.mRawPtr = ptr as *mut _;
}
}