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

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

Issue 2875753002: Implement aura::WindowPortMus::CreateCompositorFrameSink() (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: 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 df0ad3f928eb32b6699386d8c3f8eb223a4fb50b..b39624a5d655479e69f6b171abda0ab82da141f4 100644
--- a/components/viz/client/client_compositor_frame_sink.cc
+++ b/components/viz/client/client_compositor_frame_sink.cc
@@ -17,19 +17,24 @@ ClientCompositorFrameSink::ClientCompositorFrameSink(
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
- bool enable_surface_synchronization)
+ bool generate_local_surface_id)
: 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)),
- enable_surface_synchronization_(enable_surface_synchronization) {
+ generate_local_surface_id_(generate_local_surface_id) {
DETACH_FROM_THREAD(thread_checker_);
}
ClientCompositorFrameSink::~ClientCompositorFrameSink() {}
+void ClientCompositorFrameSink::SetSurfaceChangedCallback(
+ const SurfaceChangedCallback& callback) {
+ surface_changed_callback_ = callback;
+}
+
bool ClientCompositorFrameSink::BindToClient(
cc::CompositorFrameSinkClient* client) {
if (!cc::CompositorFrameSink::BindToClient(client))
@@ -58,7 +63,7 @@ void ClientCompositorFrameSink::DetachFromClient() {
void ClientCompositorFrameSink::SetLocalSurfaceId(
const cc::LocalSurfaceId& local_surface_id) {
DCHECK(local_surface_id.is_valid());
- DCHECK(enable_surface_synchronization_);
+ DCHECK(!generate_local_surface_id_);
local_surface_id_ = local_surface_id;
}
@@ -72,15 +77,20 @@ void ClientCompositorFrameSink::SubmitCompositorFrame(
DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
frame.metadata.begin_frame_ack.sequence_number);
+ bool surface_changed = false;
gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
if (!local_surface_id_.is_valid() ||
frame_size != last_submitted_frame_size_) {
last_submitted_frame_size_ = frame_size;
- if (!enable_surface_synchronization_)
+ if (generate_local_surface_id_) {
local_surface_id_ = id_allocator_.GenerateId();
+ surface_changed = true;
+ }
}
compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
std::move(frame));
+ if (surface_changed && surface_changed_callback_)
+ surface_changed_callback_.Run(local_surface_id_, frame_size);
}
void ClientCompositorFrameSink::DidNotProduceFrame(

Powered by Google App Engine
This is Rietveld 408576698