Bug 1355187 - Rename some struct fields so that the Rust/C++ names are the same. r?rhunt draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 10 Apr 2017 15:31:18 -0400
changeset 559898 ab5d258d7c610fa7ca1aed1e7369670194c42c0a
parent 559897 8798be1bc52df4eaded39e1c809e51bb2536af61
child 559899 b45df194b6db96f2ec21cc4f0179cb4656e3aff7
push id53262
push userkgupta@mozilla.com
push dateMon, 10 Apr 2017 19:36:51 +0000
reviewersrhunt
bugs1355187
milestone55.0a1
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
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi.h
--- 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();