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

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

Issue 2317493003: cc: Toward merging DrawFrame and SwapBuffers in DelegatingRenderer. (Closed)
Patch Set: merge-draw-swap Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/proxy_impl.h" 5 #include "cc/trees/proxy_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 DrawResult result; 607 DrawResult result;
608 if (layer_tree_host_impl_->CanDraw()) { 608 if (layer_tree_host_impl_->CanDraw()) {
609 result = layer_tree_host_impl_->PrepareToDraw(&frame); 609 result = layer_tree_host_impl_->PrepareToDraw(&frame);
610 draw_frame = forced_draw || result == DRAW_SUCCESS; 610 draw_frame = forced_draw || result == DRAW_SUCCESS;
611 } else { 611 } else {
612 result = DRAW_ABORTED_CANT_DRAW; 612 result = DRAW_ABORTED_CANT_DRAW;
613 } 613 }
614 614
615 if (draw_frame) { 615 if (draw_frame) {
616 layer_tree_host_impl_->DrawLayers(&frame); 616 layer_tree_host_impl_->DrawLayers(&frame);
617 if (layer_tree_host_impl_->SwapBuffers(frame))
618 scheduler_->DidSwapBuffers();
617 result = DRAW_SUCCESS; 619 result = DRAW_SUCCESS;
618 } else { 620 } else {
619 DCHECK_NE(DRAW_SUCCESS, result); 621 DCHECK_NE(DRAW_SUCCESS, result);
620 } 622 }
623
621 layer_tree_host_impl_->DidDrawAllLayers(frame); 624 layer_tree_host_impl_->DidDrawAllLayers(frame);
622 625
623 bool start_ready_animations = draw_frame; 626 bool start_ready_animations = draw_frame;
624 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 627 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
625 628
626 if (draw_frame) {
627 if (layer_tree_host_impl_->SwapBuffers(frame))
628 scheduler_->DidSwapBuffers();
629 }
630
631 // Tell the main thread that the the newly-commited frame was drawn. 629 // Tell the main thread that the the newly-commited frame was drawn.
632 if (next_frame_is_newly_committed_frame_) { 630 if (next_frame_is_newly_committed_frame_) {
633 next_frame_is_newly_committed_frame_ = false; 631 next_frame_is_newly_committed_frame_ = false;
634 channel_impl_->DidCommitAndDrawFrame(); 632 channel_impl_->DidCommitAndDrawFrame();
635 } 633 }
636 634
637 DCHECK_NE(INVALID_RESULT, result); 635 DCHECK_NE(INVALID_RESULT, result);
638 return result; 636 return result;
639 } 637 }
640 638
641 bool ProxyImpl::IsImplThread() const { 639 bool ProxyImpl::IsImplThread() const {
642 return task_runner_provider_->IsImplThread(); 640 return task_runner_provider_->IsImplThread();
643 } 641 }
644 642
645 bool ProxyImpl::IsMainThreadBlocked() const { 643 bool ProxyImpl::IsMainThreadBlocked() const {
646 return task_runner_provider_->IsMainThreadBlocked(); 644 return task_runner_provider_->IsMainThreadBlocked();
647 } 645 }
648 646
649 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 647 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
650 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 648 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
651 return main_thread_blocked_commit_vars_unsafe_; 649 return main_thread_blocked_commit_vars_unsafe_;
652 } 650 }
653 651
654 } // namespace cc 652 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698