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

Unified Diff: content/renderer/gpu/renderer_compositor_frame_sink.cc

Issue 2882303002: Factor FrameData out of RendererCompositorFrameSink (Closed)
Patch Set: c 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
« no previous file with comments | « content/renderer/gpu/renderer_compositor_frame_sink.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/renderer_compositor_frame_sink.cc
diff --git a/content/renderer/gpu/renderer_compositor_frame_sink.cc b/content/renderer/gpu/renderer_compositor_frame_sink.cc
index f06784c42a312865cc027ea7ac8d7d73b27e29d7..2be7c4fb9e5837ad4737f9aaaea689d49174ddbe 100644
--- a/content/renderer/gpu/renderer_compositor_frame_sink.cc
+++ b/content/renderer/gpu/renderer_compositor_frame_sink.cc
@@ -125,9 +125,13 @@ void RendererCompositorFrameSink::SubmitCompositorFrame(
// We should only submit CompositorFrames with valid BeginFrameAcks.
DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
frame.metadata.begin_frame_ack.sequence_number);
- if (ShouldAllocateNewLocalSurfaceId(frame))
+ auto new_surface_properties =
+ RenderWidgetSurfaceProperties::FromCompositorFrame(frame);
+ if (!local_surface_id_.is_valid() ||
+ new_surface_properties != current_surface_properties_) {
local_surface_id_ = id_allocator_.GenerateId();
- UpdateFrameData(frame);
+ current_surface_properties_ = new_surface_properties;
+ }
{
std::unique_ptr<FrameSwapMessageQueue::SendMessageScope>
@@ -164,53 +168,6 @@ void RendererCompositorFrameSink::OnBeginFrameIPC(
external_begin_frame_source_->OnBeginFrame(args);
}
-bool RendererCompositorFrameSink::ShouldAllocateNewLocalSurfaceId(
- const cc::CompositorFrame& frame) {
- cc::RenderPass* root_pass = frame.render_pass_list.back().get();
- gfx::Size frame_size = root_pass->output_rect.size();
-
- // Once the proposal in crbug.com/689754 is implemented, the LocalSurfaceId
- // allocation logic will be unified across all platforms.
- return !local_surface_id_.is_valid() ||
- current_frame_data_.device_scale_factor !=
- frame.metadata.device_scale_factor ||
-#ifdef OS_ANDROID
- current_frame_data_.top_controls_height !=
- frame.metadata.top_controls_height ||
- current_frame_data_.top_controls_shown_ratio !=
- frame.metadata.top_controls_shown_ratio ||
- current_frame_data_.bottom_controls_height !=
- frame.metadata.bottom_controls_height ||
- current_frame_data_.bottom_controls_shown_ratio !=
- frame.metadata.bottom_controls_shown_ratio ||
- current_frame_data_.viewport_selection != frame.metadata.selection ||
- current_frame_data_.has_transparent_background !=
- root_pass->has_transparent_background ||
-#endif
- current_frame_data_.frame_size != frame_size;
-}
-
-void RendererCompositorFrameSink::UpdateFrameData(
- const cc::CompositorFrame& frame) {
- cc::RenderPass* root_pass = frame.render_pass_list.back().get();
- gfx::Size frame_size = root_pass->output_rect.size();
-
- current_frame_data_.frame_size = frame_size;
- current_frame_data_.device_scale_factor = frame.metadata.device_scale_factor;
-#ifdef OS_ANDROID
- current_frame_data_.top_controls_height = frame.metadata.top_controls_height;
- current_frame_data_.top_controls_shown_ratio =
- frame.metadata.top_controls_shown_ratio;
- current_frame_data_.bottom_controls_height =
- frame.metadata.bottom_controls_height;
- current_frame_data_.bottom_controls_shown_ratio =
- frame.metadata.bottom_controls_shown_ratio;
- current_frame_data_.viewport_selection = frame.metadata.selection;
- current_frame_data_.has_transparent_background =
- root_pass->has_transparent_background;
-#endif
-}
-
void RendererCompositorFrameSink::DidReceiveCompositorFrameAck(
const cc::ReturnedResourceArray& resources) {
ReclaimResources(resources);
« no previous file with comments | « content/renderer/gpu/renderer_compositor_frame_sink.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698