Bug 1443152 - Update to cbindgen 0.5.2. r?rhunt draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 12 Mar 2018 16:38:10 -0400
changeset 766394 6a3f57ee02af31b8ed8c63c4cb1945b3f5fecad0
parent 766212 d6957f004e9cc3d7408ac3a8f2b49ff97556e27f
push id102315
push userkgupta@mozilla.com
push dateMon, 12 Mar 2018 20:38:41 +0000
reviewersrhunt
bugs1443152
milestone61.0a1
Bug 1443152 - Update to cbindgen 0.5.2. r?rhunt MozReview-Commit-ID: COIPhZvMJK
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/cbindgen.toml
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -252,16 +252,18 @@ WebRenderAPI::ShutdownExternalLogHandler
 
 /*static*/ already_AddRefed<WebRenderAPI>
 WebRenderAPI::Create(layers::CompositorBridgeParentBase* aBridge,
                      RefPtr<widget::CompositorWidget>&& aWidget,
                      LayoutDeviceIntSize aSize)
 {
   MOZ_ASSERT(aBridge);
   MOZ_ASSERT(aWidget);
+  static_assert(sizeof(size_t) == sizeof(uintptr_t),
+      "The FFI bindings assume size_t is the same size as uintptr_t!");
 
   static uint64_t sNextId = 1;
   auto id = NewWindowId(sNextId++);
 
   wr::DocumentHandle* docHandle = nullptr;
   uint32_t maxTextureSize = 0;
   bool useANGLE = false;
   layers::SyncHandle syncHandle = 0;
--- a/gfx/webrender_bindings/cbindgen.toml
+++ b/gfx/webrender_bindings/cbindgen.toml
@@ -1,16 +1,16 @@
 header = """/* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
 autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
  * To generate this file:
- *   1. Get the latest cbindgen using `cargo +nightly install --force cbindgen`
+ *   1. Get the latest cbindgen using `cargo install --force cbindgen`
  *      a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
- *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
+ *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
  */"""
 include_version = true
 braces = "SameLine"
 line_length = 100
 tab_width = 2
 language = "C++"
 namespaces = ["mozilla", "wr"]
 
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -1,19 +1,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* Generated with cbindgen:0.5.0 */
+/* Generated with cbindgen:0.5.2 */
 
 /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
  * To generate this file:
- *   1. Get the latest cbindgen using `cargo +nightly install --force cbindgen`
+ *   1. Get the latest cbindgen using `cargo install --force cbindgen`
  *      a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
- *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
+ *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
  */
 
 #include <cstdint>
 #include <cstdlib>
 
 namespace mozilla {
 namespace wr {
 
@@ -339,30 +339,30 @@ using LayoutSize = LayerSize;
 struct BuiltDisplayListDescriptor {
   // The first IPC time stamp: before any work has been done
   uint64_t builder_start_time;
   // The second IPC time stamp: after serialization
   uint64_t builder_finish_time;
   // The third IPC time stamp: just before sending
   uint64_t send_start_time;
   // The amount of clips ids assigned while building this display list.
-  size_t total_clip_ids;
+  uintptr_t total_clip_ids;
 
   bool operator==(const BuiltDisplayListDescriptor& aOther) const {
     return builder_start_time == aOther.builder_start_time &&
            builder_finish_time == aOther.builder_finish_time &&
            send_start_time == aOther.send_start_time &&
            total_clip_ids == aOther.total_clip_ids;
   }
 };
 
 struct WrVecU8 {
   uint8_t *data;
-  size_t length;
-  size_t capacity;
+  uintptr_t length;
+  uintptr_t capacity;
 
   bool operator==(const WrVecU8& aOther) const {
     return data == aOther.data &&
            length == aOther.length &&
            capacity == aOther.capacity;
   }
 };
 
@@ -718,29 +718,29 @@ struct GlyphOptions {
 };
 
 using WrYuvColorSpace = YuvColorSpace;
 
 using WrLogLevelFilter = LevelFilter;
 
 struct ByteSlice {
   const uint8_t *buffer;
-  size_t len;
+  uintptr_t len;
 
   bool operator==(const ByteSlice& aOther) const {
     return buffer == aOther.buffer &&
            len == aOther.len;
   }
 };
 
 using TileOffset = TypedPoint2D<uint16_t, Tiles>;
 
 struct MutByteSlice {
   uint8_t *buffer;
-  size_t len;
+  uintptr_t len;
 
   bool operator==(const MutByteSlice& aOther) const {
     return buffer == aOther.buffer &&
            len == aOther.len;
   }
 };
 
 struct WrWindowId {
@@ -784,17 +784,17 @@ struct WrDebugFlags {
 struct WrExternalImage {
   WrExternalImageType image_type;
   uint32_t handle;
   float u0;
   float v0;
   float u1;
   float v1;
   const uint8_t *buff;
-  size_t size;
+  uintptr_t size;
 
   bool operator==(const WrExternalImage& aOther) const {
     return image_type == aOther.image_type &&
            handle == aOther.handle &&
            u0 == aOther.u0 &&
            v0 == aOther.v0 &&
            u1 == aOther.u1 &&
            v1 == aOther.v1 &&
@@ -925,24 +925,24 @@ struct WrTransformProperty {
   uint64_t id;
   LayoutTransform transform;
 };
 
 extern "C" {
 
 /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
  * To generate this file:
- *   1. Get the latest cbindgen using `cargo +nightly install --force cbindgen`
+ *   1. Get the latest cbindgen using `cargo install --force cbindgen`
  *      a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
- *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
+ *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
  */
 
 extern void AddFontData(WrFontKey aKey,
                         const uint8_t *aData,
-                        size_t aSize,
+                        uintptr_t aSize,
                         uint32_t aIndex,
                         const ArcVecU8 *aVec);
 
 extern void AddNativeFontHandle(WrFontKey aKey,
                                 void *aHandle,
                                 uint32_t aIndex);
 
 extern void DeleteFontData(WrFontKey aKey);
@@ -1017,17 +1017,17 @@ bool wr_api_hit_test(DocumentHandle *aDh
                      WorldPoint aPoint,
                      WrPipelineId *aOutPipelineId,
                      uint64_t *aOutScrollId,
                      uint16_t *aOutHitInfo)
 WR_FUNC;
 
 WR_INLINE
 void wr_api_send_external_event(DocumentHandle *aDh,
-                                size_t aEvt)
+                                uintptr_t aEvt)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE
 void wr_api_send_transaction(DocumentHandle *aDh,
                              Transaction *aTransaction)
 WR_FUNC;
 
 WR_INLINE
@@ -1042,44 +1042,44 @@ WR_INLINE
 void wr_dec_ref_arc(const VecU8 *aArc)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE
 void wr_dp_clear_save(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
-size_t wr_dp_define_clip(WrState *aState,
-                         const size_t *aAncestorScrollId,
-                         const size_t *aAncestorClipId,
-                         LayoutRect aClipRect,
-                         const ComplexClipRegion *aComplex,
-                         size_t aComplexCount,
-                         const WrImageMask *aMask)
+uintptr_t wr_dp_define_clip(WrState *aState,
+                            const uintptr_t *aAncestorScrollId,
+                            const uintptr_t *aAncestorClipId,
+                            LayoutRect aClipRect,
+                            const ComplexClipRegion *aComplex,
+                            uintptr_t aComplexCount,
+                            const WrImageMask *aMask)
 WR_FUNC;
 
 WR_INLINE
-size_t wr_dp_define_scroll_layer(WrState *aState,
-                                 uint64_t aScrollId,
-                                 const size_t *aAncestorScrollId,
-                                 const size_t *aAncestorClipId,
-                                 LayoutRect aContentRect,
-                                 LayoutRect aClipRect)
+uintptr_t wr_dp_define_scroll_layer(WrState *aState,
+                                    uint64_t aScrollId,
+                                    const uintptr_t *aAncestorScrollId,
+                                    const uintptr_t *aAncestorClipId,
+                                    LayoutRect aContentRect,
+                                    LayoutRect aClipRect)
 WR_FUNC;
 
 WR_INLINE
-size_t wr_dp_define_sticky_frame(WrState *aState,
-                                 LayoutRect aContentRect,
-                                 const float *aTopMargin,
-                                 const float *aRightMargin,
-                                 const float *aBottomMargin,
-                                 const float *aLeftMargin,
-                                 StickyOffsetBounds aVerticalBounds,
-                                 StickyOffsetBounds aHorizontalBounds,
-                                 LayoutVector2D aAppliedOffset)
+uintptr_t wr_dp_define_sticky_frame(WrState *aState,
+                                    LayoutRect aContentRect,
+                                    const float *aTopMargin,
+                                    const float *aRightMargin,
+                                    const float *aBottomMargin,
+                                    const float *aLeftMargin,
+                                    StickyOffsetBounds aVerticalBounds,
+                                    StickyOffsetBounds aHorizontalBounds,
+                                    LayoutVector2D aAppliedOffset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_pop_all_shadows(WrState *aState)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_pop_clip(WrState *aState)
@@ -1114,17 +1114,17 @@ WR_INLINE
 void wr_dp_push_border_gradient(WrState *aState,
                                 LayoutRect aRect,
                                 LayoutRect aClip,
                                 bool aIsBackfaceVisible,
                                 BorderWidths aWidths,
                                 LayoutPoint aStartPoint,
                                 LayoutPoint aEndPoint,
                                 const GradientStop *aStops,
-                                size_t aStopsCount,
+                                uintptr_t aStopsCount,
                                 ExtendMode aExtendMode,
                                 SideOffsets2D<float> aOutset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_border_image(WrState *aState,
                              LayoutRect aRect,
                              LayoutRect aClip,
@@ -1141,17 +1141,17 @@ WR_INLINE
 void wr_dp_push_border_radial_gradient(WrState *aState,
                                        LayoutRect aRect,
                                        LayoutRect aClip,
                                        bool aIsBackfaceVisible,
                                        BorderWidths aWidths,
                                        LayoutPoint aCenter,
                                        LayoutSize aRadius,
                                        const GradientStop *aStops,
-                                       size_t aStopsCount,
+                                       uintptr_t aStopsCount,
                                        ExtendMode aExtendMode,
                                        SideOffsets2D<float> aOutset)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_box_shadow(WrState *aState,
                            LayoutRect aRect,
                            LayoutRect aClip,
@@ -1167,23 +1167,23 @@ WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_clear_rect(WrState *aState,
                            LayoutRect aRect)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_clip(WrState *aState,
-                     size_t aClipId)
+                     uintptr_t aClipId)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_clip_and_scroll_info(WrState *aState,
-                                     size_t aScrollId,
-                                     const size_t *aClipId)
+                                     uintptr_t aScrollId,
+                                     const uintptr_t *aClipId)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_iframe(WrState *aState,
                        LayoutRect aRect,
                        bool aIsBackfaceVisible,
                        WrPipelineId aPipelineId)
 WR_FUNC;
@@ -1214,47 +1214,47 @@ WR_FUNC;
 WR_INLINE
 void wr_dp_push_linear_gradient(WrState *aState,
                                 LayoutRect aRect,
                                 LayoutRect aClip,
                                 bool aIsBackfaceVisible,
                                 LayoutPoint aStartPoint,
                                 LayoutPoint aEndPoint,
                                 const GradientStop *aStops,
-                                size_t aStopsCount,
+                                uintptr_t aStopsCount,
                                 ExtendMode aExtendMode,
                                 LayoutSize aTileSize,
                                 LayoutSize aTileSpacing)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_radial_gradient(WrState *aState,
                                 LayoutRect aRect,
                                 LayoutRect aClip,
                                 bool aIsBackfaceVisible,
                                 LayoutPoint aCenter,
                                 LayoutSize aRadius,
                                 const GradientStop *aStops,
-                                size_t aStopsCount,
+                                uintptr_t aStopsCount,
                                 ExtendMode aExtendMode,
                                 LayoutSize aTileSize,
                                 LayoutSize aTileSpacing)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_rect(WrState *aState,
                      LayoutRect aRect,
                      LayoutRect aClip,
                      bool aIsBackfaceVisible,
                      ColorF aColor)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_scroll_layer(WrState *aState,
-                             size_t aScrollId)
+                             uintptr_t aScrollId)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_shadow(WrState *aState,
                        LayoutRect aBounds,
                        LayoutRect aClip,
                        bool aIsBackfaceVisible,
                        Shadow aShadow)
@@ -1265,17 +1265,17 @@ void wr_dp_push_stacking_context(WrState
                                  LayoutRect aBounds,
                                  const WrAnimationProperty *aAnimation,
                                  const float *aOpacity,
                                  const LayoutTransform *aTransform,
                                  TransformStyle aTransformStyle,
                                  const LayoutTransform *aPerspective,
                                  MixBlendMode aMixBlendMode,
                                  const WrFilterOp *aFilters,
-                                 size_t aFilterCount,
+                                 uintptr_t aFilterCount,
                                  bool aIsBackfaceVisible)
 WR_FUNC;
 
 WR_INLINE
 void wr_dp_push_text(WrState *aState,
                      LayoutRect aBounds,
                      LayoutRect aClip,
                      bool aIsBackfaceVisible,
@@ -1342,17 +1342,17 @@ extern bool wr_moz2d_render_cb(ByteSlice
                                uint32_t aWidth,
                                uint32_t aHeight,
                                ImageFormat aFormat,
                                const uint16_t *aTileSize,
                                const TileOffset *aTileOffset,
                                MutByteSlice aOutput);
 
 extern void wr_notifier_external_event(WrWindowId aWindowId,
-                                       size_t aRawEvent);
+                                       uintptr_t aRawEvent);
 
 extern void wr_notifier_new_frame_ready(WrWindowId aWindowId);
 
 extern void wr_notifier_new_scroll_frame_ready(WrWindowId aWindowId,
                                                bool aCompositeNeeded);
 
 extern void wr_notifier_wake_up(WrWindowId aWindowId);
 
@@ -1397,17 +1397,17 @@ WR_INLINE
 WrDebugFlags wr_renderer_get_debug_flags(Renderer *aRenderer)
 WR_FUNC;
 
 WR_INLINE
 void wr_renderer_readback(Renderer *aRenderer,
                           uint32_t aWidth,
                           uint32_t aHeight,
                           uint8_t *aDstBuffer,
-                          size_t aBufferSize)
+                          uintptr_t aBufferSize)
 WR_FUNC;
 
 WR_INLINE
 bool wr_renderer_render(Renderer *aRenderer,
                         uint32_t aWidth,
                         uint32_t aHeight)
 WR_FUNC;
 
@@ -1540,17 +1540,17 @@ WR_FUNC;
 
 WR_INLINE
 void wr_state_delete(WrState *aState)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE
 WrState *wr_state_new(WrPipelineId aPipelineId,
                       LayoutSize aContentSize,
-                      size_t aCapacity)
+                      uintptr_t aCapacity)
 WR_FUNC;
 
 WR_INLINE
 void wr_thread_pool_delete(WrThreadPool *aThreadPool)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE
 WrThreadPool *wr_thread_pool_new()
@@ -1611,19 +1611,19 @@ WR_INLINE
 void wr_transaction_set_window_parameters(Transaction *aTxn,
                                           const DeviceUintSize *aWindowSize,
                                           const DeviceUintRect *aDocRect)
 WR_FUNC;
 
 WR_INLINE
 void wr_transaction_update_dynamic_properties(Transaction *aTxn,
                                               const WrOpacityProperty *aOpacityArray,
-                                              size_t aOpacityCount,
+                                              uintptr_t aOpacityCount,
                                               const WrTransformProperty *aTransformArray,
-                                              size_t aTransformCount)
+                                              uintptr_t aTransformCount)
 WR_FUNC;
 
 WR_INLINE
 void wr_transaction_update_epoch(Transaction *aTxn,
                                  WrPipelineId aPipelineId,
                                  WrEpoch aEpoch)
 WR_FUNC;
 
@@ -1654,12 +1654,12 @@ WR_FUNC;
 
 } // extern "C"
 
 } // namespace wr
 } // namespace mozilla
 
 /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
  * To generate this file:
- *   1. Get the latest cbindgen using `cargo +nightly install --force cbindgen`
+ *   1. Get the latest cbindgen using `cargo install --force cbindgen`
  *      a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
- *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
+ *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
  */