OLD | NEW |
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // other sources will eventually be removed and this will be the only path. | 324 // other sources will eventually be removed and this will be the only path. |
325 scheduler_->SetBeginFrameSource(source); | 325 scheduler_->SetBeginFrameSource(source); |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 void ProxyImpl::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { | 329 void ProxyImpl::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
330 DCHECK(IsImplThread()); | 330 DCHECK(IsImplThread()); |
331 scheduler_->SetEstimatedParentDrawTime(draw_time); | 331 scheduler_->SetEstimatedParentDrawTime(draw_time); |
332 } | 332 } |
333 | 333 |
334 void ProxyImpl::DidSwapBuffersOnImplThread() { | |
335 DCHECK(IsImplThread()); | |
336 scheduler_->DidSwapBuffers(); | |
337 } | |
338 | |
339 void ProxyImpl::DidSwapBuffersCompleteOnImplThread() { | 334 void ProxyImpl::DidSwapBuffersCompleteOnImplThread() { |
340 TRACE_EVENT0("cc,benchmark", "ProxyImpl::DidSwapBuffersCompleteOnImplThread"); | 335 TRACE_EVENT0("cc,benchmark", "ProxyImpl::DidSwapBuffersCompleteOnImplThread"); |
341 DCHECK(IsImplThread()); | 336 DCHECK(IsImplThread()); |
342 scheduler_->DidSwapBuffersComplete(); | 337 scheduler_->DidSwapBuffersComplete(); |
343 channel_impl_->DidCompleteSwapBuffers(); | 338 channel_impl_->DidCompleteSwapBuffers(); |
344 } | 339 } |
345 | 340 |
346 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { | 341 void ProxyImpl::OnCanDrawStateChanged(bool can_draw) { |
347 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); | 342 TRACE_EVENT1("cc", "ProxyImpl::OnCanDrawStateChanged", "can_draw", can_draw); |
348 DCHECK(IsImplThread()); | 343 DCHECK(IsImplThread()); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 layer_tree_host_impl_->DrawLayers(&frame); | 648 layer_tree_host_impl_->DrawLayers(&frame); |
654 result = DRAW_SUCCESS; | 649 result = DRAW_SUCCESS; |
655 } else { | 650 } else { |
656 DCHECK_NE(DRAW_SUCCESS, result); | 651 DCHECK_NE(DRAW_SUCCESS, result); |
657 } | 652 } |
658 layer_tree_host_impl_->DidDrawAllLayers(frame); | 653 layer_tree_host_impl_->DidDrawAllLayers(frame); |
659 | 654 |
660 bool start_ready_animations = draw_frame; | 655 bool start_ready_animations = draw_frame; |
661 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | 656 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
662 | 657 |
663 if (draw_frame) | 658 if (draw_frame) { |
664 layer_tree_host_impl_->SwapBuffers(frame); | 659 if (layer_tree_host_impl_->SwapBuffers(frame)) |
| 660 scheduler_->DidSwapBuffers(); |
| 661 } |
665 | 662 |
666 // Tell the main thread that the the newly-commited frame was drawn. | 663 // Tell the main thread that the the newly-commited frame was drawn. |
667 if (next_frame_is_newly_committed_frame_) { | 664 if (next_frame_is_newly_committed_frame_) { |
668 next_frame_is_newly_committed_frame_ = false; | 665 next_frame_is_newly_committed_frame_ = false; |
669 channel_impl_->DidCommitAndDrawFrame(); | 666 channel_impl_->DidCommitAndDrawFrame(); |
670 } | 667 } |
671 | 668 |
672 DCHECK_NE(INVALID_RESULT, result); | 669 DCHECK_NE(INVALID_RESULT, result); |
673 return result; | 670 return result; |
674 } | 671 } |
675 | 672 |
676 bool ProxyImpl::IsImplThread() const { | 673 bool ProxyImpl::IsImplThread() const { |
677 return task_runner_provider_->IsImplThread(); | 674 return task_runner_provider_->IsImplThread(); |
678 } | 675 } |
679 | 676 |
680 bool ProxyImpl::IsMainThreadBlocked() const { | 677 bool ProxyImpl::IsMainThreadBlocked() const { |
681 return task_runner_provider_->IsMainThreadBlocked(); | 678 return task_runner_provider_->IsMainThreadBlocked(); |
682 } | 679 } |
683 | 680 |
684 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 681 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
685 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 682 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
686 return main_thread_blocked_commit_vars_unsafe_; | 683 return main_thread_blocked_commit_vars_unsafe_; |
687 } | 684 } |
688 | 685 |
689 } // namespace cc | 686 } // namespace cc |
OLD | NEW |