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

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: add-draw-result-checks 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 DrawResult result; 594 DrawResult result;
595 if (layer_tree_host_impl_->CanDraw()) { 595 if (layer_tree_host_impl_->CanDraw()) {
596 result = layer_tree_host_impl_->PrepareToDraw(&frame); 596 result = layer_tree_host_impl_->PrepareToDraw(&frame);
597 draw_frame = forced_draw || result == DRAW_SUCCESS; 597 draw_frame = forced_draw || result == DRAW_SUCCESS;
598 } else { 598 } else {
599 result = DRAW_ABORTED_CANT_DRAW; 599 result = DRAW_ABORTED_CANT_DRAW;
600 } 600 }
601 601
602 if (draw_frame) { 602 if (draw_frame) {
603 layer_tree_host_impl_->DrawLayers(&frame); 603 layer_tree_host_impl_->DrawLayers(&frame);
604 if (layer_tree_host_impl_->SwapBuffers(frame))
605 scheduler_->DidSwapBuffers();
604 result = DRAW_SUCCESS; 606 result = DRAW_SUCCESS;
605 } else { 607 } else {
606 DCHECK_NE(DRAW_SUCCESS, result); 608 DCHECK_NE(DRAW_SUCCESS, result);
607 } 609 }
610
608 layer_tree_host_impl_->DidDrawAllLayers(frame); 611 layer_tree_host_impl_->DidDrawAllLayers(frame);
609 612
610 bool start_ready_animations = draw_frame; 613 bool start_ready_animations = draw_frame;
611 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 614 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
612 615
613 if (draw_frame) {
614 if (layer_tree_host_impl_->SwapBuffers(frame))
615 scheduler_->DidSwapBuffers();
616 }
617
618 // Tell the main thread that the the newly-commited frame was drawn. 616 // Tell the main thread that the the newly-commited frame was drawn.
619 if (next_frame_is_newly_committed_frame_) { 617 if (next_frame_is_newly_committed_frame_) {
620 next_frame_is_newly_committed_frame_ = false; 618 next_frame_is_newly_committed_frame_ = false;
621 channel_impl_->DidCommitAndDrawFrame(); 619 channel_impl_->DidCommitAndDrawFrame();
622 } 620 }
623 621
624 DCHECK_NE(INVALID_RESULT, result); 622 DCHECK_NE(INVALID_RESULT, result);
625 return result; 623 return result;
626 } 624 }
627 625
628 bool ProxyImpl::IsImplThread() const { 626 bool ProxyImpl::IsImplThread() const {
629 return task_runner_provider_->IsImplThread(); 627 return task_runner_provider_->IsImplThread();
630 } 628 }
631 629
632 bool ProxyImpl::IsMainThreadBlocked() const { 630 bool ProxyImpl::IsMainThreadBlocked() const {
633 return task_runner_provider_->IsMainThreadBlocked(); 631 return task_runner_provider_->IsMainThreadBlocked();
634 } 632 }
635 633
636 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 634 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
637 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 635 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
638 return main_thread_blocked_commit_vars_unsafe_; 636 return main_thread_blocked_commit_vars_unsafe_;
639 } 637 }
640 638
641 } // namespace cc 639 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698