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

Unified Diff: components/viz/client/client_compositor_frame_sink.cc

Issue 2923583002: Remove RendererCompositorFrameSink and use ClientCompositorFrameSink instead (Closed)
Patch Set: Fix windows Created 3 years, 6 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: components/viz/client/client_compositor_frame_sink.cc
diff --git a/components/viz/client/client_compositor_frame_sink.cc b/components/viz/client/client_compositor_frame_sink.cc
index e363f8c58e75735b9ef737af62a2f795a56f7762..3fe17a6c0fdf3a40fcfa2d0be2b67dddef1da713 100644
--- a/components/viz/client/client_compositor_frame_sink.cc
+++ b/components/viz/client/client_compositor_frame_sink.cc
@@ -9,6 +9,7 @@
#include "cc/output/begin_frame_args.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_sink_client.h"
+#include "components/viz/client/local_surface_id_provider.h"
namespace viz {
@@ -20,11 +21,13 @@ ClientCompositorFrameSink::ClientCompositorFrameSink(
std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source,
cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
+ std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider,
bool enable_surface_synchronization)
: cc::CompositorFrameSink(std::move(context_provider),
std::move(worker_context_provider),
gpu_memory_buffer_manager,
shared_bitmap_manager),
+ local_surface_id_provider_(std::move(local_surface_id_provider)),
synthetic_begin_frame_source_(std::move(synthetic_begin_frame_source)),
compositor_frame_sink_info_(std::move(compositor_frame_sink_info)),
client_request_(std::move(client_request)),
@@ -38,8 +41,10 @@ ClientCompositorFrameSink::ClientCompositorFrameSink(
std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source,
cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
+ std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider,
bool enable_surface_synchronization)
: cc::CompositorFrameSink(std::move(vulkan_context_provider)),
+ local_surface_id_provider_(std::move(local_surface_id_provider)),
synthetic_begin_frame_source_(std::move(synthetic_begin_frame_source)),
compositor_frame_sink_info_(std::move(compositor_frame_sink_info)),
client_request_(std::move(client_request)),
@@ -94,13 +99,10 @@ void ClientCompositorFrameSink::SubmitCompositorFrame(
DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
frame.metadata.begin_frame_ack.sequence_number);
- if (!enable_surface_synchronization_ &&
- (!local_surface_id_.is_valid() || ShouldAllocateNewLocalSurfaceId(frame)))
- local_surface_id_ = id_allocator_.GenerateId();
-
- surface_size_ = frame.render_pass_list.back()->output_rect.size();
- device_scale_factor_ = frame.metadata.device_scale_factor;
-
+ if (!enable_surface_synchronization_) {
+ local_surface_id_ =
+ local_surface_id_provider_->GetLocalSurfaceIdForFrame(frame);
+ }
compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
std::move(frame));
}
@@ -131,13 +133,6 @@ void ClientCompositorFrameSink::ReclaimResources(
client_->ReclaimResources(resources);
}
-bool ClientCompositorFrameSink::ShouldAllocateNewLocalSurfaceId(
- const cc::CompositorFrame& frame) {
- gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
- return frame_size != surface_size_ ||
- device_scale_factor_ != frame.metadata.device_scale_factor;
-}
-
void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) {
compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames);
}
« no previous file with comments | « components/viz/client/client_compositor_frame_sink.h ('k') | components/viz/client/local_surface_id_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698