Index: content/renderer/android/synchronous_compositor_frame_sink.cc |
diff --git a/content/renderer/android/synchronous_compositor_frame_sink.cc b/content/renderer/android/synchronous_compositor_frame_sink.cc |
index be2a84041928de80e7d66ef149aa80ba0da4fddb..9ea9ba4a50978d60919996ee4e68629a97ffb399 100644 |
--- a/content/renderer/android/synchronous_compositor_frame_sink.cc |
+++ b/content/renderer/android/synchronous_compositor_frame_sink.cc |
@@ -242,14 +242,6 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
// the |frame| for the software path below. |
submit_frame.metadata = frame.metadata.Clone(); |
- if (!root_local_surface_id_.is_valid()) { |
- root_local_surface_id_ = local_surface_id_allocator_->GenerateId(); |
- child_local_surface_id_ = local_surface_id_allocator_->GenerateId(); |
- } |
- |
- display_->SetLocalSurfaceId(root_local_surface_id_, |
- frame.metadata.device_scale_factor); |
- |
// The layer compositor should be giving a frame that covers the |
// |sw_viewport_for_current_draw_| but at 0,0. |
gfx::Size child_size = sw_viewport_for_current_draw_.size(); |
@@ -261,6 +253,23 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
sw_viewport_for_current_draw_.bottom()); |
display_->Resize(display_size); |
+ if (!root_local_surface_id_.is_valid() || display_size_ != display_size || |
+ device_scale_factor_ != frame.metadata.device_scale_factor) { |
+ root_local_surface_id_ = local_surface_id_allocator_->GenerateId(); |
+ display_size_ = display_size; |
+ device_scale_factor_ = frame.metadata.device_scale_factor; |
+ } |
+ |
+ if (!child_local_surface_id_.is_valid() || child_size_ != child_size || |
+ device_scale_factor_ != frame.metadata.device_scale_factor) { |
+ child_local_surface_id_ = local_surface_id_allocator_->GenerateId(); |
+ child_size_ = child_size; |
+ device_scale_factor_ = frame.metadata.device_scale_factor; |
+ } |
+ |
+ display_->SetLocalSurfaceId(root_local_surface_id_, |
+ frame.metadata.device_scale_factor); |
+ |
// The offset for the child frame relative to the origin of the canvas being |
// drawn into. |
gfx::Transform child_transform; |
@@ -274,6 +283,8 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
// hardware frames in SurfacesInstance?) |
cc::CompositorFrame embed_frame; |
embed_frame.metadata.begin_frame_ack = frame.metadata.begin_frame_ack; |
+ embed_frame.metadata.device_scale_factor = |
+ frame.metadata.device_scale_factor; |
embed_frame.render_pass_list.push_back(cc::RenderPass::Create()); |
// The embedding RenderPass covers the entire Display's area. |
@@ -296,10 +307,12 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
cc::SurfaceId(kChildFrameSinkId, child_local_surface_id_), |
cc::SurfaceDrawQuadType::PRIMARY, nullptr); |
- child_support_->SubmitCompositorFrame(child_local_surface_id_, |
- std::move(frame)); |
- root_support_->SubmitCompositorFrame(root_local_surface_id_, |
- std::move(embed_frame)); |
+ bool result = child_support_->SubmitCompositorFrame(child_local_surface_id_, |
+ std::move(frame)); |
+ DCHECK(result); |
+ result = root_support_->SubmitCompositorFrame(root_local_surface_id_, |
+ std::move(embed_frame)); |
+ DCHECK(result); |
display_->DrawAndSwap(); |
} else { |
// For hardware draws we send the whole frame to the client so it can draw |