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

Unified Diff: android_webview/browser/hardware_renderer.cc

Issue 2347563003: Added FrameFuture class (Closed)
Patch Set: Code review 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
Index: android_webview/browser/hardware_renderer.cc
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index c0702cc4553d57443c2da1104efde4c867b2d5db..c7e3b836b76b608ae64d76aeeddeb1df1d52eaae 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -63,12 +63,18 @@ void HardwareRenderer::CommitFrame() {
if (!child_frame.get())
return;
- last_committed_compositor_frame_sink_id_ =
- child_frame->compositor_frame_sink_id;
+ // Wait for frame, then extract CompositorFrame and
boliu 2016/09/20 00:27:56 I think HardwareRenderer do not need to be aware o
ojars 2016/09/22 18:21:38 Done.
+ // compositor_frame_sink_id_.
+ child_frame->frame_future->Wait();
+ frame_ = std::move(child_frame->frame_future->getFrame()->frame);
+ compositor_frame_sink_id_ =
+ child_frame->frame_future->getFrame()->compositor_frame_sink_id;
+
+ last_committed_compositor_frame_sink_id_ = compositor_frame_sink_id_;
ReturnResourcesInChildFrame();
child_frame_ = std::move(child_frame);
- DCHECK(child_frame_->frame.get());
- DCHECK(!child_frame_->frame->gl_frame_data);
+ DCHECK(frame_.get());
+ DCHECK(!frame_->gl_frame_data);
}
void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info,
@@ -88,24 +94,22 @@ void HardwareRenderer::DrawGL(AwDrawGLInfo* draw_info,
// during "kModeSync" stage (which does not allow GL) might result in extra
// kModeProcess. Instead, submit the frame in "kModeDraw" stage to avoid
// unnecessary kModeProcess.
- if (child_frame_.get() && child_frame_->frame.get()) {
+ if (child_frame_.get() && frame_.get()) {
if (!compositor_id_.Equals(child_frame_->compositor_id) ||
- last_submitted_compositor_frame_sink_id_ !=
- child_frame_->compositor_frame_sink_id) {
+ last_submitted_compositor_frame_sink_id_ != compositor_frame_sink_id_) {
if (!child_id_.is_null())
DestroySurface();
// This will return all the resources to the previous compositor.
surface_factory_.reset();
compositor_id_ = child_frame_->compositor_id;
- last_submitted_compositor_frame_sink_id_ =
- child_frame_->compositor_frame_sink_id;
+ last_submitted_compositor_frame_sink_id_ = compositor_frame_sink_id_;
surface_factory_.reset(
new cc::SurfaceFactory(surfaces_->GetSurfaceManager(), this));
}
std::unique_ptr<cc::CompositorFrame> child_compositor_frame =
- std::move(child_frame_->frame);
+ std::move(frame_);
gfx::Size frame_size =
child_compositor_frame->delegated_frame_data->render_pass_list.back()
@@ -181,17 +185,16 @@ void HardwareRenderer::SetBackingFrameBufferObject(
}
void HardwareRenderer::ReturnResourcesInChildFrame() {
- if (child_frame_.get() && child_frame_->frame.get()) {
+ if (child_frame_.get() && frame_.get()) {
cc::ReturnedResourceArray resources_to_return;
cc::TransferableResource::ReturnResources(
- child_frame_->frame->delegated_frame_data->resource_list,
- &resources_to_return);
+ frame_->delegated_frame_data->resource_list, &resources_to_return);
// The child frame's compositor id is not necessarily same as
// compositor_id_.
ReturnResourcesToCompositor(resources_to_return,
child_frame_->compositor_id,
- child_frame_->compositor_frame_sink_id);
+ compositor_frame_sink_id_);
}
child_frame_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698