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

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

Issue 2755463002: [cc] Fix CompositorFrameSinkSupport BeginFrameAck interface. (Closed)
Patch Set: sync Created 3 years, 9 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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/base/switches.h" 10 #include "cc/base/switches.h"
11 #include "cc/output/begin_frame_args.h"
11 #include "cc/output/compositor_frame.h" 12 #include "cc/output/compositor_frame.h"
12 #include "cc/output/compositor_frame_sink_client.h" 13 #include "cc/output/compositor_frame_sink_client.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 // static 17 // static
17 std::unique_ptr<ClientCompositorFrameSink> ClientCompositorFrameSink::Create( 18 std::unique_ptr<ClientCompositorFrameSink> ClientCompositorFrameSink::Create(
18 const cc::FrameSinkId& frame_sink_id, 19 const cc::FrameSinkId& frame_sink_id,
19 scoped_refptr<cc::ContextProvider> context_provider, 20 scoped_refptr<cc::ContextProvider> context_provider,
20 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 21 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 local_surface_id_ = local_surface_id; 71 local_surface_id_ = local_surface_id;
71 } 72 }
72 73
73 void ClientCompositorFrameSink::SubmitCompositorFrame( 74 void ClientCompositorFrameSink::SubmitCompositorFrame(
74 cc::CompositorFrame frame) { 75 cc::CompositorFrame frame) {
75 DCHECK(thread_checker_); 76 DCHECK(thread_checker_);
76 DCHECK(thread_checker_->CalledOnValidThread()); 77 DCHECK(thread_checker_->CalledOnValidThread());
77 if (!compositor_frame_sink_) 78 if (!compositor_frame_sink_)
78 return; 79 return;
79 80
81 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
82 frame.metadata.begin_frame_ack.sequence_number);
83
80 gfx::Size frame_size = last_submitted_frame_size_; 84 gfx::Size frame_size = last_submitted_frame_size_;
81 if (!frame.render_pass_list.empty()) 85 if (!frame.render_pass_list.empty())
82 frame_size = frame.render_pass_list.back()->output_rect.size(); 86 frame_size = frame.render_pass_list.back()->output_rect.size();
83 if (!enable_surface_synchronization_ && 87 if (!enable_surface_synchronization_ &&
84 (!local_surface_id_.is_valid() || 88 (!local_surface_id_.is_valid() ||
85 frame_size != last_submitted_frame_size_)) { 89 frame_size != last_submitted_frame_size_)) {
86 local_surface_id_ = id_allocator_.GenerateId(); 90 local_surface_id_ = id_allocator_.GenerateId();
87 } 91 }
88 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_, 92 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
89 std::move(frame)); 93 std::move(frame));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const cc::LocalSurfaceId& local_surface_id, 138 const cc::LocalSurfaceId& local_surface_id,
135 const gfx::Rect& damage_rect) { 139 const gfx::Rect& damage_rect) {
136 // TODO(fsamuel, staraz): Implement this. 140 // TODO(fsamuel, staraz): Implement this.
137 } 141 }
138 142
139 void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { 143 void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) {
140 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); 144 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames);
141 } 145 }
142 146
143 void ClientCompositorFrameSink::OnDidFinishFrame(const cc::BeginFrameAck& ack) { 147 void ClientCompositorFrameSink::OnDidFinishFrame(const cc::BeginFrameAck& ack) {
144 // TODO(eseckler): Pass on the ack to compositor_frame_sink_. 148 // If there was damage, the submitted CompositorFrame includes the ack.
149 if (!ack.has_damage)
150 compositor_frame_sink_->BeginFrameDidNotSwap(ack);
145 } 151 }
146 152
147 ClientCompositorFrameSinkBinding::~ClientCompositorFrameSinkBinding() {} 153 ClientCompositorFrameSinkBinding::~ClientCompositorFrameSinkBinding() {}
148 154
149 ClientCompositorFrameSinkBinding::ClientCompositorFrameSinkBinding( 155 ClientCompositorFrameSinkBinding::ClientCompositorFrameSinkBinding(
150 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request, 156 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request,
151 cc::mojom::MojoCompositorFrameSinkClientPtrInfo 157 cc::mojom::MojoCompositorFrameSinkClientPtrInfo
152 compositor_frame_sink_client) 158 compositor_frame_sink_client)
153 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)), 159 : compositor_frame_sink_request_(std::move(compositor_frame_sink_request)),
154 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {} 160 compositor_frame_sink_client_(std::move(compositor_frame_sink_client)) {}
155 161
156 cc::mojom::MojoCompositorFrameSinkRequest 162 cc::mojom::MojoCompositorFrameSinkRequest
157 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() { 163 ClientCompositorFrameSinkBinding::TakeFrameSinkRequest() {
158 return std::move(compositor_frame_sink_request_); 164 return std::move(compositor_frame_sink_request_);
159 } 165 }
160 166
161 cc::mojom::MojoCompositorFrameSinkClientPtrInfo 167 cc::mojom::MojoCompositorFrameSinkClientPtrInfo
162 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() { 168 ClientCompositorFrameSinkBinding::TakeFrameSinkClient() {
163 return std::move(compositor_frame_sink_client_); 169 return std::move(compositor_frame_sink_client_);
164 } 170 }
165 171
166 } // namespace ui 172 } // namespace ui
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_frame_sink.cc ('k') | services/ui/ws/display_client_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698