Bug 1355187 - Rename some struct fields so that the Rust/C++ names are the same. r?rhunt
The binding generator just takes the Rust field names and uses that in the
generated C++ structs. So installing the autogenerated bindings is easier if
we make sure the names are the same ahead of time.
MozReview-Commit-ID: 6cuzmtI5Qqw
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -475,17 +475,17 @@ struct ByteBuffer
bool mOwned;
};
inline WrByteSlice RangeToByteSlice(mozilla::Range<uint8_t> aRange) {
return WrByteSlice { aRange.begin().get(), aRange.length() };
}
inline mozilla::Range<uint8_t> ByteSliceToRange(WrByteSlice aWrSlice) {
- return mozilla::Range<uint8_t>(aWrSlice.mBuffer, aWrSlice.mLength);
+ return mozilla::Range<uint8_t>(aWrSlice.buffer, aWrSlice.len);
}
struct BuiltDisplayList {
VecU8 dl;
WrBuiltDisplayListDescriptor dl_desc;
VecU8 aux;
WrAuxiliaryListsDescriptor aux_desc;
};
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -561,28 +561,28 @@ impl WrImageDescriptor {
is_opaque: self.is_opaque,
offset: 0,
}
}
}
#[repr(C)]
pub struct WrVecU8 {
- ptr: *mut u8,
+ data: *mut u8,
length: usize,
capacity: usize,
}
impl WrVecU8 {
fn to_vec(self) -> Vec<u8> {
- unsafe { Vec::from_raw_parts(self.ptr, self.length, self.capacity) }
+ unsafe { Vec::from_raw_parts(self.data, self.length, self.capacity) }
}
fn from_vec(mut v: Vec<u8>) -> WrVecU8 {
let w = WrVecU8 {
- ptr: v.as_mut_ptr(),
+ data: v.as_mut_ptr(),
length: v.len(),
capacity: v.capacity(),
};
mem::forget(v);
w
}
}
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -61,18 +61,18 @@ WR_DECL_FFI_2(WrFontKey, uint32_t, uint3
#undef WR_DECL_FFI_1
#undef WR_DECL_FFI_2
// FFI-safe slice of bytes. Use this accross the FFI boundary to pass a temporary
// view of a buffer of bytes.
// The canonical gecko equivalent is mozilla::Range<uint8_t>.
struct WrByteSlice {
- uint8_t* mBuffer;
- size_t mLength;
+ uint8_t* buffer;
+ size_t len;
};
// ----
// Functions invoked from Rust code
// ----
bool is_in_compositor_thread();
bool is_in_main_thread();