Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2066)

Unified Diff: android_webview/browser/hardware_renderer.cc

Issue 2383933002: Added message filter receiving frames from compositor
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | android_webview/browser/render_thread_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/hardware_renderer.cc
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index fdc5d70dc7a9b26fcdfef1eef1bf8d757f7d90cf..4dfe508b0534de3b322c7d33e1c00e1fe2e55be6 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -60,20 +60,40 @@ void HardwareRenderer::CommitFrame() {
scroll_offset_ = render_thread_manager_->GetScrollOffsetOnRT();
std::unique_ptr<ChildFrame> child_frame =
render_thread_manager_->PassFrameOnRT();
+ frame_future_ = render_thread_manager_->PassFrameFutureOnRT();
if (!child_frame.get())
return;
-
- last_committed_compositor_frame_sink_id_ =
- child_frame->compositor_frame_sink_id;
ReturnResourcesInChildFrame();
child_frame_ = std::move(child_frame);
- DCHECK(child_frame_->frame.get());
- DCHECK(!child_frame_->frame->gl_frame_data);
}
void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info) {
TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL");
+ if (frame_future_.get() && child_frame_.get() && !child_frame_->frame.get()) {
+ std::unique_ptr<content::SynchronousCompositor::Frame> frame;
+ {
+ TRACE_EVENT0("android_webview", "GetFrame");
+ frame = frame_future_->getFrame();
+ }
+
+ std::unique_ptr<cc::CompositorFrame> compositor_frame =
+ std::move(frame->frame);
+
+ child_frame_ = base::MakeUnique<ChildFrame>(
+ frame->compositor_frame_sink_id, std::move(compositor_frame),
+ child_frame_->compositor_id,
+ child_frame_->viewport_rect_for_tile_priority_empty,
+ child_frame_->transform_for_tile_priority,
+ child_frame_->offscreen_pre_raster, child_frame_->is_layer);
+
+ last_committed_compositor_frame_sink_id_ =
+ child_frame_->compositor_frame_sink_id;
+ // DCHECK(child_frame_->frame.get());
+ // DCHECK(!child_frame_->frame->gl_frame_data);
+ frame_future_ = nullptr;
+ }
+
// We need to watch if the current Android context has changed and enforce
// a clean-up in the compositor.
EGLContext current_context = eglGetCurrentContext();
« no previous file with comments | « android_webview/browser/hardware_renderer.h ('k') | android_webview/browser/render_thread_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698