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

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 787763006: cc: Adding BeginFrameTracker object and removing Now() from LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding documentation as requested by Brian. Created 6 years 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
« cc/trees/layer_tree_host_impl.h ('K') | « cc/trees/layer_tree_impl.cc ('k') | 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // RequestNewOutputSurface could have synchronously created an output 488 // RequestNewOutputSurface could have synchronously created an output
489 // surface, so check again before returning. 489 // surface, so check again before returning.
490 if (layer_tree_host_->output_surface_lost()) 490 if (layer_tree_host_->output_surface_lost())
491 return; 491 return;
492 } 492 }
493 493
494 { 494 {
495 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( 495 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create(
496 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), 496 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(),
497 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS)); 497 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS));
498 layer_tree_host_impl_->UpdateCurrentBeginFrameArgs(begin_frame_args);
498 DoBeginMainFrame(begin_frame_args); 499 DoBeginMainFrame(begin_frame_args);
499 DoCommit(); 500 DoCommit();
500 501
501 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) 502 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises())
502 << "Commit should always succeed and transfer promises."; 503 << "Commit should always succeed and transfer promises.";
503 } 504 }
504 505
505 { 506 {
506 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); 507 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this));
507 if (layer_tree_host_impl_->settings().impl_side_painting) { 508 if (layer_tree_host_impl_->settings().impl_side_painting) {
508 layer_tree_host_impl_->ActivateSyncTree(); 509 layer_tree_host_impl_->ActivateSyncTree();
509 layer_tree_host_impl_->active_tree()->UpdateDrawProperties(); 510 layer_tree_host_impl_->active_tree()->UpdateDrawProperties();
510 layer_tree_host_impl_->PrepareTiles(); 511 layer_tree_host_impl_->PrepareTiles();
511 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); 512 layer_tree_host_impl_->SynchronouslyInitializeAllTiles();
512 } 513 }
513 514
514 DoAnimate(); 515 DoAnimate();
515 516
516 LayerTreeHostImpl::FrameData frame; 517 LayerTreeHostImpl::FrameData frame;
517 DoComposite(frame_begin_time, &frame); 518 DoComposite(frame_begin_time, &frame);
518 519
519 // DoComposite could abort, but because this is a synchronous composite 520 // DoComposite could abort, but because this is a synchronous composite
520 // another draw will never be scheduled, so break remaining promises. 521 // another draw will never be scheduled, so break remaining promises.
521 layer_tree_host_impl_->active_tree()->BreakSwapPromises( 522 layer_tree_host_impl_->active_tree()->BreakSwapPromises(
522 SwapPromise::SWAP_FAILS); 523 SwapPromise::SWAP_FAILS);
524
525 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
523 } 526 }
524 } 527 }
525 528
526 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { 529 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const {
527 // The following line casts away const modifiers because it is just 530 // The following line casts away const modifiers because it is just
528 // setting debug state. We still want the AsValue() function and its 531 // setting debug state. We still want the AsValue() function and its
529 // call chain to be const throughout. 532 // call chain to be const throughout.
530 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); 533 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this));
531 534
532 state->BeginDictionary("layer_tree_host_impl"); 535 state->BeginDictionary("layer_tree_host_impl");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 timing_history_.DidStartDrawing(); 590 timing_history_.DidStartDrawing();
588 591
589 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); 592 draw_result = layer_tree_host_impl_->PrepareToDraw(frame);
590 draw_frame = draw_result == DRAW_SUCCESS; 593 draw_frame = draw_result == DRAW_SUCCESS;
591 if (draw_frame) 594 if (draw_frame)
592 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); 595 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
593 layer_tree_host_impl_->DidDrawAllLayers(*frame); 596 layer_tree_host_impl_->DidDrawAllLayers(*frame);
594 597
595 bool start_ready_animations = draw_frame; 598 bool start_ready_animations = draw_frame;
596 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 599 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
597 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
598 600
599 timing_history_.DidFinishDrawing(); 601 timing_history_.DidFinishDrawing();
600 } 602 }
601 603
602 if (draw_frame) { 604 if (draw_frame) {
603 DebugScopedSetImplThread impl(this); 605 DebugScopedSetImplThread impl(this);
604 606
605 // This CapturePostTasks should be destroyed before 607 // This CapturePostTasks should be destroyed before
606 // DidCommitAndDrawFrame() is called since that goes out to the 608 // DidCommitAndDrawFrame() is called since that goes out to the
607 // embedder, 609 // embedder,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 800
799 void SingleThreadProxy::DidBeginImplFrameDeadline() { 801 void SingleThreadProxy::DidBeginImplFrameDeadline() {
800 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 802 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
801 } 803 }
802 804
803 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 805 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
804 layer_tree_host_->SendBeginFramesToChildren(args); 806 layer_tree_host_->SendBeginFramesToChildren(args);
805 } 807 }
806 808
807 } // namespace cc 809 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.h ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698