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

Side by Side Diff: services/ui/public/cpp/client_compositor_frame_sink.cc

Issue 2888043004: [cc] Add and plumb CFS::DidNotProduceFrame. (Closed)
Patch Set: address nits, rename to DidNotProduceFrame. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/public/cpp/client_compositor_frame_sink.h" 5 #include "services/ui/public/cpp/client_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/output/begin_frame_args.h" 9 #include "cc/output/begin_frame_args.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 local_surface_id_ = local_surface_id; 70 local_surface_id_ = local_surface_id;
71 } 71 }
72 72
73 void ClientCompositorFrameSink::SubmitCompositorFrame( 73 void ClientCompositorFrameSink::SubmitCompositorFrame(
74 cc::CompositorFrame frame) { 74 cc::CompositorFrame frame) {
75 DCHECK(thread_checker_); 75 DCHECK(thread_checker_);
76 DCHECK(thread_checker_->CalledOnValidThread()); 76 DCHECK(thread_checker_->CalledOnValidThread());
77 if (!compositor_frame_sink_) 77 if (!compositor_frame_sink_)
78 return; 78 return;
79 79
80 DCHECK(frame.metadata.begin_frame_ack.has_damage);
80 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, 81 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
81 frame.metadata.begin_frame_ack.sequence_number); 82 frame.metadata.begin_frame_ack.sequence_number);
82 83
83 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 84 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
84 if (!local_surface_id_.is_valid() || 85 if (!local_surface_id_.is_valid() ||
85 frame_size != last_submitted_frame_size_) { 86 frame_size != last_submitted_frame_size_) {
86 last_submitted_frame_size_ = frame_size; 87 last_submitted_frame_size_ = frame_size;
87 if (!enable_surface_synchronization_) 88 if (!enable_surface_synchronization_)
88 local_surface_id_ = id_allocator_.GenerateId(); 89 local_surface_id_ = id_allocator_.GenerateId();
89 } 90 }
90 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, 91 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
91 std::move(frame)); 92 std::move(frame));
92 } 93 }
93 94
95 void ClientCompositorFrameSink::DidNotProduceFrame(
96 const cc::BeginFrameAck& ack) {
97 DCHECK(!ack.has_damage);
98 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
99 compositor_frame_sink_->DidNotProduceFrame(ack);
100 }
101
94 ClientCompositorFrameSink::ClientCompositorFrameSink( 102 ClientCompositorFrameSink::ClientCompositorFrameSink(
95 scoped_refptr<cc::ContextProvider> context_provider, 103 scoped_refptr<cc::ContextProvider> context_provider,
96 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 104 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
97 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, 105 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
98 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, 106 cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
99 bool enable_surface_synchronization) 107 bool enable_surface_synchronization)
100 : cc::CompositorFrameSink(std::move(context_provider), 108 : cc::CompositorFrameSink(std::move(context_provider),
101 nullptr, 109 nullptr,
102 gpu_memory_buffer_manager, 110 gpu_memory_buffer_manager,
103 nullptr), 111 nullptr),
(...skipping 22 matching lines...) Expand all
126 DCHECK(thread_checker_->CalledOnValidThread()); 134 DCHECK(thread_checker_->CalledOnValidThread());
127 if (!client_) 135 if (!client_)
128 return; 136 return;
129 client_->ReclaimResources(resources); 137 client_->ReclaimResources(resources);
130 } 138 }
131 139
132 void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { 140 void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) {
133 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); 141 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames);
134 } 142 }
135 143
136 void ClientCompositorFrameSink::OnDidFinishFrame(const cc::BeginFrameAck& ack) {
137 // If there was damage, the submitted CompositorFrame includes the ack.
138 if (!ack.has_damage)
139 compositor_frame_sink_->BeginFrameDidNotSwap(ack);
140 }
141
142 ClientCompositorFrameSinkBinding::~ClientCompositorFrameSinkBinding() {} 144 ClientCompositorFrameSinkBinding::~ClientCompositorFrameSinkBinding() {}
143 145
144 ClientCompositorFrameSinkBinding::ClientCompositorFrameSinkBinding( 146 ClientCompositorFrameSinkBinding::ClientCompositorFrameSinkBinding(
145 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request, 147 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request,
146 cc::mojom::MojoCompositorFrameSinkClientPtrInfo 148 cc::mojom::MojoCompositorFrameSinkClientPtrInfo
147 compositor_frame_sink_client) 149 compositor_frame_sink_client)
148 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)), 150 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)),
149 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {} 151 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {}
150 152
151 cc::mojom::MojoCompositorFrameSinkRequest 153 cc::mojom::MojoCompositorFrameSinkRequest
152 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { 154 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() {
153 return std::move(compositor_frame_sink_request_); 155 return std::move(compositor_frame_sink_request_);
154 } 156 }
155 157
156 cc::mojom::MojoCompositorFrameSinkClientPtrInfo 158 cc::mojom::MojoCompositorFrameSinkClientPtrInfo
157 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { 159 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() {
158 return std::move(compositor_frame_sink_client_); 160 return std::move(compositor_frame_sink_client_);
159 } 161 }
160 162
161 } // namespace ui 163 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/client_compositor_frame_sink.h ('k') | services/ui/ws/compositor_frame_sink_client_binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698