Bug 1356371 - Create a WrRenderedEpochs struct r?kats
This helps cbindgen know to generate a opaque struct for WrRenderedEpochs.
MozReview-Commit-ID: 7moOEBjjbOO
--- 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