Skip to content
Permalink
Browse files

Update WR (minimal use of new transaction API).

  • Loading branch information
gw3583 committed Jan 19, 2018
1 parent 671b69c commit 800a66fc114c5724436a8c490bdaaf4d026f4794
Showing with 37 additions and 18 deletions.
  1. +2 −2 Cargo.lock
  2. +6 −2 components/canvas/webgl_thread.rs
  3. +21 −7 components/compositing/compositor.rs
  4. +8 −7 components/layout_thread/lib.rs

Some generated files are not rendered by default. Learn more.

@@ -353,7 +353,9 @@ impl<VR: WebVRRenderHandler + 'static, OB: WebGLThreadObserver> WebGLThread<VR,
self.dom_outputs.insert(pipeline_id, DOMToTextureData {
context_id, texture_id, document_id, size
});
self.webrender_api.enable_frame_output(document_id, pipeline_id, true);
let mut txn = webrender_api::Transaction::new();
txn.enable_frame_output(pipeline_id, true);
self.webrender_api.send_transaction(document_id, txn);
},
DOMToTextureCommand::Lock(pipeline_id, gl_sync, sender) => {
let contexts = &self.contexts;
@@ -376,7 +378,9 @@ impl<VR: WebVRRenderHandler + 'static, OB: WebGLThreadObserver> WebGLThread<VR,
if let Some((pipeline_id, document_id)) = self.dom_outputs.iter()
.find(|&(_, v)| v.texture_id == texture_id)
.map(|(k, v)| (*k, v.document_id)) {
self.webrender_api.enable_frame_output(document_id, pipeline_id, false);
let mut txn = webrender_api::Transaction::new();
txn.enable_frame_output(pipeline_id, false);
self.webrender_api.send_transaction(document_id, txn);
self.dom_outputs.remove(&pipeline_id);
}
},
@@ -609,8 +609,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.root_pipeline = Some(frame_tree.pipeline.clone());

let pipeline_id = frame_tree.pipeline.id.to_webrender();
self.webrender_api.set_root_pipeline(self.webrender_document, pipeline_id);
self.webrender_api.generate_frame(self.webrender_document, None);
let mut txn = webrender_api::Transaction::new();
txn.set_root_pipeline(pipeline_id);
txn.generate_frame();
self.webrender_api.send_transaction(self.webrender_document, txn);

self.create_pipeline_details_for_frame_tree(&frame_tree);

@@ -992,7 +994,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
(combined_event.cursor.to_f32() / self.scale).to_untyped();
let location = webrender_api::ScrollLocation::Delta(delta);
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
self.webrender_api.scroll(self.webrender_document, location, cursor, combined_event.phase);
let mut txn = webrender_api::Transaction::new();
txn.scroll(location, cursor, combined_event.phase);
self.webrender_api.send_transaction(self.webrender_document, txn);
last_combined_event = None
}
}
@@ -1047,7 +1051,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
};
let cursor = (combined_event.cursor.to_f32() / self.scale).to_untyped();
let cursor = webrender_api::WorldPoint::from_untyped(&cursor);
self.webrender_api.scroll(self.webrender_document, scroll_location, cursor, combined_event.phase);
let mut txn = webrender_api::Transaction::new();
txn.scroll(scroll_location, cursor, combined_event.phase);
self.webrender_api.send_transaction(self.webrender_document, txn);
self.waiting_for_results_of_scroll = true
}

@@ -1145,7 +1151,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {

fn update_page_zoom_for_webrender(&mut self) {
let page_zoom = webrender_api::ZoomFactor::new(self.page_zoom.get());
self.webrender_api.set_page_zoom(self.webrender_document, page_zoom);

let mut txn = webrender_api::Transaction::new();
txn.set_page_zoom(page_zoom);
self.webrender_api.send_transaction(self.webrender_document, txn);
}

/// Simulate a pinch zoom
@@ -1443,7 +1452,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}

if self.webrender.layers_are_bouncing_back() {
self.webrender_api.tick_scrolling_bounce_animations(self.webrender_document);
let mut txn = webrender_api::Transaction::new();
txn.tick_scrolling_bounce_animations();
self.webrender_api.send_transaction(self.webrender_document, txn);
self.send_viewport_rects()
}
}
@@ -1537,7 +1548,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
};
flags.toggle(flag);
self.webrender.set_debug_flags(flags);
self.webrender_api.generate_frame(self.webrender_document, None);

let mut txn = webrender_api::Transaction::new();
txn.generate_frame();
self.webrender_api.send_transaction(self.webrender_document, txn);
}
}

@@ -705,12 +705,13 @@ impl LayoutThread {
rw_data.scroll_offsets.insert(state.scroll_root_id, state.scroll_offset);

let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
self.webrender_api.scroll_node_with_id(
self.webrender_document,
let mut txn = webrender_api::Transaction::new();
txn.scroll_node_with_id(
webrender_api::LayoutPoint::from_untyped(&point),
state.scroll_root_id,
webrender_api::ScrollClamping::ToContentBounds
);
self.webrender_api.send_transaction(self.webrender_document, txn);
}
Msg::ReapStyleAndLayoutData(dead_data) => {
unsafe {
@@ -1044,15 +1045,15 @@ impl LayoutThread {
// Progressive Web Metrics.
self.paint_time_metrics.maybe_observe_paint_time(self, epoch, &*display_list);

self.webrender_api.set_display_list(
self.webrender_document,
let mut txn = webrender_api::Transaction::new();
txn.set_display_list(
webrender_api::Epoch(epoch.0),
Some(get_root_flow_background_color(layout_root)),
viewport_size,
builder.finalize(),
true,
webrender_api::ResourceUpdates::new());
self.webrender_api.generate_frame(self.webrender_document, None);
true);
txn.generate_frame();
self.webrender_api.send_transaction(self.webrender_document, txn);
});
}

0 comments on commit 800a66f

Please sign in to comment.
You can’t perform that action at this time.