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

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2728183002: RendererCompositorFrameSink should handle local surface id allocation (Closed)
Patch Set: rebase Created 3 years, 9 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/browser/frame_host/render_widget_host_view_child_frame.cc
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 083f808613b3dcd76374d7da97e2f17f9e75098d..2d155bccc2f19ff27e8b8a5810692dfa392b57e6 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -58,7 +58,6 @@ RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
current_surface_scale_factor_(1.f),
frame_connector_(nullptr),
weak_factory_(this) {
- id_allocator_.reset(new cc::LocalSurfaceIdAllocator());
GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
CreateCompositorFrameSinkSupport();
}
@@ -351,6 +350,7 @@ void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck() {
void RenderWidgetHostViewChildFrame::ProcessCompositorFrame(
uint32_t compositor_frame_sink_id,
+ const cc::LocalSurfaceId& local_surface_id,
cc::CompositorFrame frame) {
// If the renderer changed its frame sink, reset the
// CompositorFrameSinkSupport to avoid returning stale resources.
@@ -358,26 +358,19 @@ void RenderWidgetHostViewChildFrame::ProcessCompositorFrame(
ResetCompositorFrameSinkSupport();
CreateCompositorFrameSinkSupport();
last_compositor_frame_sink_id_ = compositor_frame_sink_id;
- local_surface_id_ = cc::LocalSurfaceId();
}
- gfx::Size new_frame_size = frame.render_pass_list.back()->output_rect.size();
- float new_scale_factor = frame.metadata.device_scale_factor;
- bool allocated_new_local_surface_id = false;
- if (!local_surface_id_.is_valid() ||
- new_frame_size != current_surface_size_ ||
- new_scale_factor != current_surface_scale_factor_) {
- local_surface_id_ = id_allocator_->GenerateId();
- current_surface_size_ = frame.render_pass_list.back()->output_rect.size();
- current_surface_scale_factor_ = frame.metadata.device_scale_factor;
- allocated_new_local_surface_id = true;
- }
+ current_surface_size_ = frame.render_pass_list.back()->output_rect.size();
+ current_surface_scale_factor_ = frame.metadata.device_scale_factor;
- support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
+ support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
has_frame_ = true;
- if (allocated_new_local_surface_id || HasEmbedderChanged())
+ if (local_surface_id_ != local_surface_id || HasEmbedderChanged()) {
+ local_surface_id_ = local_surface_id;
SendSurfaceInfoToEmbedder();
+ }
+
ProcessFrameSwappedCallbacks();
}
@@ -402,13 +395,15 @@ void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedderImpl(
void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
uint32_t compositor_frame_sink_id,
+ const cc::LocalSurfaceId& local_surface_id,
cc::CompositorFrame frame) {
TRACE_EVENT0("content",
"RenderWidgetHostViewChildFrame::OnSwapCompositorFrame");
last_scroll_offset_ = frame.metadata.root_scroll_offset;
if (!frame_connector_)
return;
- ProcessCompositorFrame(compositor_frame_sink_id, std::move(frame));
+ ProcessCompositorFrame(compositor_frame_sink_id, local_surface_id,
+ std::move(frame));
}
void RenderWidgetHostViewChildFrame::ProcessFrameSwappedCallbacks() {

Powered by Google App Engine
This is Rietveld 408576698