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

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

Issue 2921713002: Reland "Send FrameSwapMessageQueue's messages in QueueMessageSwapPromise" with fixes (Closed)
Patch Set: Don't pass to RCFS Created 3 years, 6 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 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_frame_sink.h" 5 #include "content/renderer/android/synchronous_compositor_frame_sink.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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 DCHECK(result); 316 DCHECK(result);
317 display_->DrawAndSwap(); 317 display_->DrawAndSwap();
318 } else { 318 } else {
319 // For hardware draws we send the whole frame to the client so it can draw 319 // For hardware draws we send the whole frame to the client so it can draw
320 // the content in it. 320 // the content in it.
321 submit_frame = std::move(frame); 321 submit_frame = std::move(frame);
322 } 322 }
323 323
324 sync_client_->SubmitCompositorFrame(compositor_frame_sink_id_, 324 sync_client_->SubmitCompositorFrame(compositor_frame_sink_id_,
325 std::move(submit_frame)); 325 std::move(submit_frame));
326 DeliverMessages();
327 did_submit_frame_ = true; 326 did_submit_frame_ = true;
328 } 327 }
329 328
330 void SynchronousCompositorFrameSink::DidNotProduceFrame( 329 void SynchronousCompositorFrameSink::DidNotProduceFrame(
331 const cc::BeginFrameAck& ack) { 330 const cc::BeginFrameAck& ack) {
332 DCHECK(!ack.has_damage); 331 DCHECK(!ack.has_damage);
333 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); 332 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
334 Send(new ViewHostMsg_DidNotProduceFrame(routing_id_, ack)); 333 Send(new ViewHostMsg_DidNotProduceFrame(routing_id_, ack));
335 } 334 }
336 335
337 void SynchronousCompositorFrameSink::CancelFallbackTick() { 336 void SynchronousCompositorFrameSink::CancelFallbackTick() {
338 fallback_tick_.Cancel(); 337 fallback_tick_.Cancel();
339 fallback_tick_pending_ = false; 338 fallback_tick_pending_ = false;
340 } 339 }
341 340
342 void SynchronousCompositorFrameSink::FallbackTickFired() { 341 void SynchronousCompositorFrameSink::FallbackTickFired() {
343 DCHECK(CalledOnValidThread()); 342 DCHECK(CalledOnValidThread());
344 TRACE_EVENT0("renderer", "SynchronousCompositorFrameSink::FallbackTickFired"); 343 TRACE_EVENT0("renderer", "SynchronousCompositorFrameSink::FallbackTickFired");
345 base::AutoReset<bool> in_fallback_tick(&fallback_tick_running_, true); 344 base::AutoReset<bool> in_fallback_tick(&fallback_tick_running_, true);
345 frame_swap_message_queue_->NotifyFramesAreDiscarded(true);
346 SkBitmap bitmap; 346 SkBitmap bitmap;
347 bitmap.allocN32Pixels(1, 1); 347 bitmap.allocN32Pixels(1, 1);
348 bitmap.eraseColor(0); 348 bitmap.eraseColor(0);
349 SkCanvas canvas(bitmap); 349 SkCanvas canvas(bitmap);
350 fallback_tick_pending_ = false; 350 fallback_tick_pending_ = false;
351 DemandDrawSw(&canvas); 351 DemandDrawSw(&canvas);
352 frame_swap_message_queue_->NotifyFramesAreDiscarded(false);
352 } 353 }
353 354
354 void SynchronousCompositorFrameSink::Invalidate() { 355 void SynchronousCompositorFrameSink::Invalidate() {
355 DCHECK(CalledOnValidThread()); 356 DCHECK(CalledOnValidThread());
356 if (sync_client_) 357 if (sync_client_)
357 sync_client_->Invalidate(); 358 sync_client_->Invalidate();
358 359
359 if (!fallback_tick_pending_) { 360 if (!fallback_tick_pending_) {
360 fallback_tick_.Reset( 361 fallback_tick_.Reset(
361 base::Bind(&SynchronousCompositorFrameSink::FallbackTickFired, 362 base::Bind(&SynchronousCompositorFrameSink::FallbackTickFired,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 const cc::ReturnedResourceArray& resources) { 496 const cc::ReturnedResourceArray& resources) {
496 DCHECK(resources.empty()); 497 DCHECK(resources.empty());
497 client_->ReclaimResources(resources); 498 client_->ReclaimResources(resources);
498 } 499 }
499 500
500 void SynchronousCompositorFrameSink::WillDrawSurface( 501 void SynchronousCompositorFrameSink::WillDrawSurface(
501 const cc::LocalSurfaceId& local_surface_id, 502 const cc::LocalSurfaceId& local_surface_id,
502 const gfx::Rect& damage_rect) {} 503 const gfx::Rect& damage_rect) {}
503 504
504 } // namespace content 505 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/renderer/gpu/frame_swap_message_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698