Chromium Code Reviews| Index: content/browser/android/synchronous_compositor_host.cc |
| diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc |
| index 658c818db71bef42528c35f486eafbe4e77ae9de..e9c1631d48525770c5226ad24e9e386a4ea59a1d 100644 |
| --- a/content/browser/android/synchronous_compositor_host.cc |
| +++ b/content/browser/android/synchronous_compositor_host.cc |
| @@ -40,6 +40,7 @@ SynchronousCompositorHost::SynchronousCompositorHost( |
| use_in_process_zero_copy_software_draw_(use_in_proc_software_draw), |
| is_active_(false), |
| bytes_limit_(0u), |
| + current_output_surface_id_(0u), |
|
hush (inactive)
2016/03/08 23:55:49
Not sure where we get the correct value of current
boliu
2016/03/09 00:29:59
Yes
hush (inactive)
2016/03/09 02:36:17
yeah. Renaming the variable name to indicate this
|
| root_scroll_offset_updated_by_browser_(false), |
| renderer_param_version_(0u), |
| need_animate_scroll_(false), |
| @@ -70,7 +71,7 @@ void SynchronousCompositorHost::DidBecomeCurrent() { |
| client_->DidBecomeCurrent(this); |
| } |
| -scoped_ptr<cc::CompositorFrame> SynchronousCompositorHost::DemandDrawHw( |
| +SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw( |
| const gfx::Size& surface_size, |
| const gfx::Transform& transform, |
| const gfx::Rect& viewport, |
| @@ -80,22 +81,23 @@ scoped_ptr<cc::CompositorFrame> SynchronousCompositorHost::DemandDrawHw( |
| SyncCompositorDemandDrawHwParams params(surface_size, transform, viewport, |
| clip, viewport_rect_for_tile_priority, |
| transform_for_tile_priority); |
| - scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
| + SynchronousCompositor::Frame frame; |
| + frame.frame.reset(new cc::CompositorFrame); |
| SyncCompositorCommonBrowserParams common_browser_params; |
| PopulateCommonParams(&common_browser_params); |
| SyncCompositorCommonRendererParams common_renderer_params; |
| if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw( |
| routing_id_, common_browser_params, params, &common_renderer_params, |
| - frame.get()))) { |
| - return nullptr; |
| + &frame.output_surface_id, frame.frame.get()))) { |
| + return SynchronousCompositor::Frame(); |
| } |
| ProcessCommonParams(common_renderer_params); |
| - if (!frame->delegated_frame_data) { |
| + if (!frame.frame->delegated_frame_data) { |
| // This can happen if compositor did not swap in this draw. |
| - frame.reset(); |
| + frame.frame.reset(); |
| } |
| - if (frame) |
| - UpdateFrameMetaData(frame->metadata); |
| + if (frame.frame) |
| + UpdateFrameMetaData(frame.frame->metadata); |
| return frame; |
| } |
| @@ -267,7 +269,12 @@ void SynchronousCompositorHost::SendZeroMemory() { |
| } |
| void SynchronousCompositorHost::ReturnResources( |
| + uint32_t output_surface_id, |
| const cc::CompositorFrameAck& frame_ack) { |
| + if (current_output_surface_id_ != output_surface_id) { |
| + returned_resources_.clear(); |
| + current_output_surface_id_ = output_surface_id; |
| + } |
| returned_resources_.insert(returned_resources_.end(), |
| frame_ack.resources.begin(), |
| frame_ack.resources.end()); |
| @@ -380,6 +387,7 @@ void SynchronousCompositorHost::PopulateCommonParams( |
| DCHECK(params); |
| DCHECK(params->ack.resources.empty()); |
| params->bytes_limit = bytes_limit_; |
| + params->output_surface_id = current_output_surface_id_; |
| params->ack.resources.swap(returned_resources_); |
| if (root_scroll_offset_updated_by_browser_) { |
| params->root_scroll_offset = root_scroll_offset_; |