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

Unified Diff: services/ui/public/cpp/client_compositor_frame_sink.cc

Issue 2886873002: Only send the FrameSinkId to client when it is necessary (Closed)
Patch Set: Address review issues. 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: services/ui/public/cpp/client_compositor_frame_sink.cc
diff --git a/services/ui/public/cpp/client_compositor_frame_sink.cc b/services/ui/public/cpp/client_compositor_frame_sink.cc
index ef014e05ae77d58a8dbc11cf528072e859106aa0..487ef4dba3bf40963b51e683c91dfb7deaa23bae 100644
--- a/services/ui/public/cpp/client_compositor_frame_sink.cc
+++ b/services/ui/public/cpp/client_compositor_frame_sink.cc
@@ -5,9 +5,7 @@
#include "services/ui/public/cpp/client_compositor_frame_sink.h"
#include "base/bind.h"
-#include "base/command_line.h"
#include "base/memory/ptr_util.h"
-#include "cc/base/switches.h"
#include "cc/output/begin_frame_args.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_sink_client.h"
@@ -16,11 +14,11 @@ namespace ui {
// static
std::unique_ptr<ClientCompositorFrameSink> ClientCompositorFrameSink::Create(
- const cc::FrameSinkId& frame_sink_id,
scoped_refptr<cc::ContextProvider> context_provider,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
std::unique_ptr<ClientCompositorFrameSinkBinding>*
- compositor_frame_sink_binding) {
+ compositor_frame_sink_binding,
+ bool enable_surface_synchronization) {
cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink;
cc::mojom::MojoCompositorFrameSinkClientPtr compositor_frame_sink_client;
cc::mojom::MojoCompositorFrameSinkClientRequest
@@ -31,9 +29,10 @@ std::unique_ptr<ClientCompositorFrameSink> ClientCompositorFrameSink::Create(
MakeRequest(&compositor_frame_sink),
compositor_frame_sink_client.PassInterface()));
return base::WrapUnique(new ClientCompositorFrameSink(
- frame_sink_id, std::move(context_provider), gpu_memory_buffer_manager,
+ std::move(context_provider), gpu_memory_buffer_manager,
compositor_frame_sink.PassInterface(),
- std::move(compositor_frame_sink_client_request)));
+ std::move(compositor_frame_sink_client_request),
+ enable_surface_synchronization));
}
ClientCompositorFrameSink::~ClientCompositorFrameSink() {}
@@ -82,33 +81,29 @@ void ClientCompositorFrameSink::SubmitCompositorFrame(
frame.metadata.begin_frame_ack.sequence_number);
gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
- if (!enable_surface_synchronization_ &&
- (!local_surface_id_.is_valid() ||
- frame_size != last_submitted_frame_size_)) {
- local_surface_id_ = id_allocator_.GenerateId();
+ if (!local_surface_id_.is_valid() ||
+ frame_size != last_submitted_frame_size_) {
+ last_submitted_frame_size_ = frame_size;
+ if (!enable_surface_synchronization_)
+ local_surface_id_ = id_allocator_.GenerateId();
}
compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
std::move(frame));
- last_submitted_frame_size_ = frame_size;
}
ClientCompositorFrameSink::ClientCompositorFrameSink(
- const cc::FrameSinkId& frame_sink_id,
scoped_refptr<cc::ContextProvider> context_provider,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
- cc::mojom::MojoCompositorFrameSinkClientRequest client_request)
+ cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
+ bool enable_surface_synchronization)
: cc::CompositorFrameSink(std::move(context_provider),
nullptr,
gpu_memory_buffer_manager,
nullptr),
compositor_frame_sink_info_(std::move(compositor_frame_sink_info)),
client_request_(std::move(client_request)),
- frame_sink_id_(frame_sink_id) {
- enable_surface_synchronization_ =
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- cc::switches::kEnableSurfaceSynchronization);
-}
+ enable_surface_synchronization_(enable_surface_synchronization) {}
void ClientCompositorFrameSink::DidReceiveCompositorFrameAck(
const cc::ReturnedResourceArray& resources) {
« no previous file with comments | « services/ui/public/cpp/client_compositor_frame_sink.h ('k') | services/ui/public/interfaces/window_manager.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698