Bug 1356371 - Create a WrRenderedEpochs struct r?kats draft
authorRyan Hunt <rhunt@eqrion.net>
Thu, 13 Apr 2017 15:03:44 -0400
changeset 562262 4c459a9759fc6f290abadaaf78969c31c4a2f153
parent 562261 3198a84c53f4a9e9c67dbb8ee6504ae09994d8ad
child 562263 2599db05d104cbfeaacfc8ff4ec51c8c0f262a91
push id54010
push userbmo:rhunt@eqrion.net
push dateThu, 13 Apr 2017 19:58:42 +0000
reviewerskats
bugs1356371
milestone55.0a1
Bug 1356371 - Create a WrRenderedEpochs struct r?kats This helps cbindgen know to generate a opaque struct for WrRenderedEpochs. MozReview-Commit-ID: 7moOEBjjbOO
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -24,17 +24,16 @@ type WrEpoch = Epoch;
 type WrExternalImageId = ExternalImageId;
 type WrFontKey = FontKey;
 type WrIdNamespace = IdNamespace;
 type WrImageFormat = ImageFormat;
 type WrImageRendering = ImageRendering;
 type WrImageKey = ImageKey;
 type WrMixBlendMode = MixBlendMode;
 type WrPipelineId = PipelineId;
-type WrRenderedEpochs = Vec<(WrPipelineId, WrEpoch)>;
 type WrRenderer = Renderer;
 type WrSideOffsets2Du32 = WrSideOffsets2D<u32>;
 type WrSideOffsets2Df32 = WrSideOffsets2D<f32>;
 
 // Enables binary recording that can be used with `wrench replay`
 // Outputs a wr-record-*.bin file for each window that is shown
 // Note: wrench will panic if external images are used, they can
 // be disabled in WebRenderBridgeParent::ProcessWebRenderCommands
@@ -740,30 +739,36 @@ pub extern "C" fn wr_renderer_current_ep
 }
 
 /// wr-binding:destructor_safe // This is used by the binding generator
 #[no_mangle]
 pub unsafe extern "C" fn wr_renderer_delete(renderer: *mut WrRenderer) {
     Box::from_raw(renderer);
 }
 
+pub struct WrRenderedEpochs {
+    data: Vec<(WrPipelineId, WrEpoch)>,
+}
+
 #[no_mangle]
 pub unsafe extern "C" fn wr_renderer_flush_rendered_epochs(renderer: &mut WrRenderer)
                                                            -> *mut WrRenderedEpochs {
     let map = renderer.flush_rendered_epochs();
-    let pipeline_epochs = Box::new(map.into_iter().collect());
+    let pipeline_epochs = Box::new(WrRenderedEpochs {
+        data: map.into_iter().collect()
+    });
     return Box::into_raw(pipeline_epochs);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_rendered_epochs_next(pipeline_epochs: &mut WrRenderedEpochs,
                                                  out_pipeline: &mut WrPipelineId,
                                                  out_epoch: &mut WrEpoch)
                                                  -> bool {
-    if let Some((pipeline, epoch)) = pipeline_epochs.pop() {
+    if let Some((pipeline, epoch)) = pipeline_epochs.data.pop() {
         *out_pipeline = pipeline;
         *out_epoch = epoch;
         return true;
     }
     return false;
 }
 
 /// wr-binding:destructor_safe // This is used by the binding generator