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

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

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Address comments 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 254ff01ad86174c367657947fc1aec7f7f822333..51e5c73b193877bc32b2e7a89cf817a0d0073c6e 100644
--- a/content/renderer/android/synchronous_compositor_frame_sink.cc
+++ b/content/renderer/android/synchronous_compositor_frame_sink.cc
@@ -243,14 +243,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();
@@ -262,6 +254,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;
@@ -275,6 +284,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.
@@ -297,10 +308,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
« no previous file with comments | « content/renderer/android/synchronous_compositor_frame_sink.h ('k') | ui/android/delegated_frame_host_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698