Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update WR (minimal use of new transaction API).
  • Loading branch information
gw3583 committed Jan 19, 2018
1 parent 671b69c commit 800a66f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions components/canvas/webgl_thread.rs
Expand Up @@ -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;
Expand All @@ -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);
}
},
Expand Down
28 changes: 21 additions & 7 deletions components/compositing/compositor.rs
Expand Up @@ -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);

Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
15 changes: 8 additions & 7 deletions components/layout_thread/lib.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
});
}

Expand Down

0 comments on commit 800a66f

Please sign in to comment.