Bug 1351506. Remove display list copy from wr_api_finalize_builder. r=nical
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 29 Mar 2017 09:06:19 -0400
changeset 553342 2cdfeef068e14815b5c675cfb485e16ea3718804
parent 553238 bad38a8000a31acd2d2cbcd9070774ab5fd286b1
child 553343 69a8dd0935e25869d9f33440d92f317535843e09
push id51601
push userfelipc@gmail.com
push dateWed, 29 Mar 2017 21:00:13 +0000
reviewersnical
bugs1351506
milestone55.0a1
Bug 1351506. Remove display list copy from wr_api_finalize_builder. r=nical The takes advantage of some new webrender api to eliminate a copy of the displaylist
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1333,21 +1333,23 @@ pub extern "C" fn wr_dp_push_box_shadow(
 pub unsafe extern "C" fn wr_api_finalize_builder(state: &mut WrState,
                                                  dl_descriptor: &mut BuiltDisplayListDescriptor,
                                                  dl_data: &mut WrVecU8,
                                                  aux_descriptor: &mut AuxiliaryListsDescriptor,
                                                  aux_data: &mut WrVecU8) {
     let frame_builder = mem::replace(&mut state.frame_builder,
                                      WebRenderFrameBuilder::new(state.pipeline_id));
     let (_, dl, aux) = frame_builder.dl_builder.finalize();
-    //XXX: get rid of the copies here
-    *dl_data = WrVecU8::from_vec(dl.data().to_owned());
-    *dl_descriptor = dl.descriptor().clone();
-    *aux_data = WrVecU8::from_vec(aux.data().to_owned());
-    *aux_descriptor = aux.descriptor().clone();
+    let (data, descriptor) = dl.into_data();
+    *dl_data = WrVecU8::from_vec(data);
+    *dl_descriptor = descriptor;
+
+    let (data, descriptor) = aux.into_data();
+    *aux_data = WrVecU8::from_vec(data);
+    *aux_descriptor = descriptor;
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn wr_dp_push_built_display_list(state: &mut WrState,
                                                        dl_descriptor: BuiltDisplayListDescriptor,
                                                        dl_data: WrVecU8,
                                                        aux_descriptor: AuxiliaryListsDescriptor,
                                                        aux_data: WrVecU8) {