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

Side by Side Diff: content/renderer/android/synchronous_compositor_output_surface.cc

Issue 2130953002: WebView: Immediately ack and return resources for fallback ticks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@displaywebview
Patch Set: bosthing: . Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/android/synchronous_compositor_output_surface.h" 5 #include "content/renderer/android/synchronous_compositor_output_surface.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Intentional no-op: surface size is controlled by the embedder. 190 // Intentional no-op: surface size is controlled by the embedder.
191 } 191 }
192 192
193 static void NoOpDrawCallback(cc::SurfaceDrawStatus s) {} 193 static void NoOpDrawCallback(cc::SurfaceDrawStatus s) {}
194 194
195 void SynchronousCompositorOutputSurface::SwapBuffers( 195 void SynchronousCompositorOutputSurface::SwapBuffers(
196 cc::CompositorFrame frame) { 196 cc::CompositorFrame frame) {
197 DCHECK(CalledOnValidThread()); 197 DCHECK(CalledOnValidThread());
198 DCHECK(sync_client_); 198 DCHECK(sync_client_);
199 199
200 if (fallback_tick_running_) {
201 client_->DidSwapBuffers();
202 client_->DidSwapBuffersComplete();
203 DCHECK(frame.delegated_frame_data->resource_list.empty());
204 cc::ReturnedResourceArray return_resources;
205 ReturnResources(return_resources);
206 return;
207 }
208
200 cc::CompositorFrame swap_frame; 209 cc::CompositorFrame swap_frame;
201 210
202 if (in_software_draw_) { 211 if (in_software_draw_) {
203 // The frame we send to the client is actually just the metadata. Preserve 212 // The frame we send to the client is actually just the metadata. Preserve
204 // the |frame| for the software path below. 213 // the |frame| for the software path below.
205 swap_frame.metadata = frame.metadata.Clone(); 214 swap_frame.metadata = frame.metadata.Clone();
206 215
207 if (delegated_surface_id_.is_null()) { 216 if (delegated_surface_id_.is_null()) {
208 delegated_surface_id_ = surface_id_allocator_->GenerateId(); 217 delegated_surface_id_ = surface_id_allocator_->GenerateId();
209 surface_factory_->Create(delegated_surface_id_); 218 surface_factory_->Create(delegated_surface_id_);
210 } 219 }
211 220
212 display_->SetSurfaceId(delegated_surface_id_, 221 display_->SetSurfaceId(delegated_surface_id_,
213 frame.metadata.device_scale_factor); 222 frame.metadata.device_scale_factor);
214 223
215 gfx::Size frame_size = 224 gfx::Size frame_size =
216 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); 225 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
217 display_->Resize(frame_size); 226 display_->Resize(frame_size);
218 227
219 surface_factory_->SubmitCompositorFrame( 228 surface_factory_->SubmitCompositorFrame(
220 delegated_surface_id_, std::move(frame), base::Bind(&NoOpDrawCallback)); 229 delegated_surface_id_, std::move(frame), base::Bind(&NoOpDrawCallback));
221 display_->DrawAndSwap(); 230 display_->DrawAndSwap();
222 } else { 231 } else {
232 // For hardware draws we send the whole frame to the client so it can draw
233 // the content in it.
223 swap_frame = std::move(frame); 234 swap_frame = std::move(frame);
224 } 235 }
225 236
226 if (!fallback_tick_running_) { 237 sync_client_->SwapBuffers(output_surface_id_, std::move(swap_frame));
227 sync_client_->SwapBuffers(output_surface_id_, std::move(swap_frame)); 238 DeliverMessages();
228 DeliverMessages();
229 }
230 client_->DidSwapBuffers(); 239 client_->DidSwapBuffers();
231 did_swap_ = true; 240 did_swap_ = true;
232 } 241 }
233 242
234 void SynchronousCompositorOutputSurface::CancelFallbackTick() { 243 void SynchronousCompositorOutputSurface::CancelFallbackTick() {
235 fallback_tick_.Cancel(); 244 fallback_tick_.Cancel();
236 fallback_tick_pending_ = false; 245 fallback_tick_pending_ = false;
237 } 246 }
238 247
239 void SynchronousCompositorOutputSurface::FallbackTickFired() { 248 void SynchronousCompositorOutputSurface::FallbackTickFired() {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 client_->ReclaimResources(&ack); 402 client_->ReclaimResources(&ack);
394 } 403 }
395 404
396 void SynchronousCompositorOutputSurface::SetBeginFrameSource( 405 void SynchronousCompositorOutputSurface::SetBeginFrameSource(
397 cc::BeginFrameSource* begin_frame_source) { 406 cc::BeginFrameSource* begin_frame_source) {
398 // Software output is synchronous and doesn't use a BeginFrameSource. 407 // Software output is synchronous and doesn't use a BeginFrameSource.
399 NOTREACHED(); 408 NOTREACHED();
400 } 409 }
401 410
402 } // namespace content 411 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698