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

Unified Diff: content/renderer/android/synchronous_compositor_frame_sink.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Fixed Android Created 3 years, 7 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: 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..9845d5864c40a241cbefcfa080ad1e2ef08e5812 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,10 @@ 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));
+ DCHECK(child_support_->SubmitCompositorFrame(child_local_surface_id_,
danakj 2017/05/19 19:00:59 and here
Saman Sami 2017/05/19 19:26:46 Done.
+ std::move(frame)));
+ DCHECK(root_support_->SubmitCompositorFrame(root_local_surface_id_,
+ std::move(embed_frame)));
display_->DrawAndSwap();
} else {
// For hardware draws we send the whole frame to the client so it can draw

Powered by Google App Engine
This is Rietveld 408576698