OLD | NEW |
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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 completion->Signal(); | 676 completion->Signal(); |
677 } | 677 } |
678 | 678 |
679 void ThreadProxy::ScheduledActionSendBeginMainFrame() { | 679 void ThreadProxy::ScheduledActionSendBeginMainFrame() { |
680 unsigned int begin_frame_id = nextBeginFrameId++; | 680 unsigned int begin_frame_id = nextBeginFrameId++; |
681 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( | 681 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( |
682 benchmark_instrumentation::kSendBeginFrame, begin_frame_id); | 682 benchmark_instrumentation::kSendBeginFrame, begin_frame_id); |
683 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( | 683 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( |
684 new BeginMainFrameAndCommitState); | 684 new BeginMainFrameAndCommitState); |
685 begin_main_frame_state->begin_frame_id = begin_frame_id; | 685 begin_main_frame_state->begin_frame_id = begin_frame_id; |
686 begin_main_frame_state->monotonic_frame_begin_time = | 686 begin_main_frame_state->begin_frame_args = |
687 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); | 687 impl().layer_tree_host_impl->CurrentBeginFrameArgs(); |
688 begin_main_frame_state->scroll_info = | 688 begin_main_frame_state->scroll_info = |
689 impl().layer_tree_host_impl->ProcessScrollDeltas(); | 689 impl().layer_tree_host_impl->ProcessScrollDeltas(); |
690 | 690 |
691 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 691 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
692 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 692 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
693 } | 693 } |
694 begin_main_frame_state->memory_allocation_limit_bytes = | 694 begin_main_frame_state->memory_allocation_limit_bytes = |
695 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 695 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
696 begin_main_frame_state->memory_allocation_priority_cutoff = | 696 begin_main_frame_state->memory_allocation_priority_cutoff = |
697 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 697 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 // On the other hand, the animate_requested flag should remain cleared | 763 // On the other hand, the animate_requested flag should remain cleared |
764 // here so that any animation requests generated by the apply or animate | 764 // here so that any animation requests generated by the apply or animate |
765 // callbacks will trigger another frame. | 765 // callbacks will trigger another frame. |
766 main().commit_requested = true; | 766 main().commit_requested = true; |
767 main().commit_request_sent_to_impl_thread = true; | 767 main().commit_request_sent_to_impl_thread = true; |
768 | 768 |
769 layer_tree_host()->ApplyScrollAndScale(*begin_main_frame_state->scroll_info); | 769 layer_tree_host()->ApplyScrollAndScale(*begin_main_frame_state->scroll_info); |
770 | 770 |
771 layer_tree_host()->WillBeginMainFrame(); | 771 layer_tree_host()->WillBeginMainFrame(); |
772 | 772 |
773 layer_tree_host()->UpdateClientAnimations( | 773 layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args); |
774 begin_main_frame_state->monotonic_frame_begin_time); | |
775 layer_tree_host()->AnimateLayers( | 774 layer_tree_host()->AnimateLayers( |
776 begin_main_frame_state->monotonic_frame_begin_time); | 775 begin_main_frame_state->begin_frame_args.frame_time); |
777 blocked_main().last_monotonic_frame_begin_time = | 776 blocked_main().last_monotonic_frame_begin_time = |
778 begin_main_frame_state->monotonic_frame_begin_time; | 777 begin_main_frame_state->begin_frame_args.frame_time; |
779 | 778 |
780 // Unlink any backings that the impl thread has evicted, so that we know to | 779 // Unlink any backings that the impl thread has evicted, so that we know to |
781 // re-paint them in UpdateLayers. | 780 // re-paint them in UpdateLayers. |
782 if (blocked_main().contents_texture_manager()) { | 781 if (blocked_main().contents_texture_manager()) { |
783 blocked_main().contents_texture_manager()->UnlinkAndClearEvictedBackings(); | 782 blocked_main().contents_texture_manager()->UnlinkAndClearEvictedBackings(); |
784 | 783 |
785 blocked_main().contents_texture_manager()->SetMaxMemoryLimitBytes( | 784 blocked_main().contents_texture_manager()->SetMaxMemoryLimitBytes( |
786 begin_main_frame_state->memory_allocation_limit_bytes); | 785 begin_main_frame_state->memory_allocation_limit_bytes); |
787 blocked_main().contents_texture_manager()->SetExternalPriorityCutoff( | 786 blocked_main().contents_texture_manager()->SetExternalPriorityCutoff( |
788 begin_main_frame_state->memory_allocation_priority_cutoff); | 787 begin_main_frame_state->memory_allocation_priority_cutoff); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 impl().layer_tree_host_impl->BeginMainFrameAborted(did_handle); | 939 impl().layer_tree_host_impl->BeginMainFrameAborted(did_handle); |
941 impl().scheduler->BeginMainFrameAborted(did_handle); | 940 impl().scheduler->BeginMainFrameAborted(did_handle); |
942 } | 941 } |
943 | 942 |
944 void ThreadProxy::ScheduledActionAnimate() { | 943 void ThreadProxy::ScheduledActionAnimate() { |
945 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); | 944 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
946 DCHECK(IsImplThread()); | 945 DCHECK(IsImplThread()); |
947 | 946 |
948 if (!impl().animations_frozen_until_next_draw) { | 947 if (!impl().animations_frozen_until_next_draw) { |
949 impl().animation_time = | 948 impl().animation_time = |
950 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); | 949 impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; |
951 } | 950 } |
952 impl().layer_tree_host_impl->Animate(impl().animation_time); | 951 impl().layer_tree_host_impl->Animate(impl().animation_time); |
953 impl().did_commit_after_animating = false; | 952 impl().did_commit_after_animating = false; |
954 } | 953 } |
955 | 954 |
956 void ThreadProxy::ScheduledActionCommit() { | 955 void ThreadProxy::ScheduledActionCommit() { |
957 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); | 956 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
958 DCHECK(IsImplThread()); | 957 DCHECK(IsImplThread()); |
959 DCHECK(IsMainThreadBlocked()); | 958 DCHECK(IsMainThreadBlocked()); |
960 DCHECK(impl().commit_completion_event); | 959 DCHECK(impl().commit_completion_event); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 | 1149 |
1151 base::TimeDelta ThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 1150 base::TimeDelta ThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
1152 return impl().timing_history.BeginMainFrameToCommitDurationEstimate(); | 1151 return impl().timing_history.BeginMainFrameToCommitDurationEstimate(); |
1153 } | 1152 } |
1154 | 1153 |
1155 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { | 1154 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { |
1156 return impl().timing_history.CommitToActivateDurationEstimate(); | 1155 return impl().timing_history.CommitToActivateDurationEstimate(); |
1157 } | 1156 } |
1158 | 1157 |
1159 void ThreadProxy::DidBeginImplFrameDeadline() { | 1158 void ThreadProxy::DidBeginImplFrameDeadline() { |
1160 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame(); | 1159 impl().layer_tree_host_impl->ResetCurrentBeginFrameArgsForNextFrame(); |
1161 } | 1160 } |
1162 | 1161 |
1163 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1162 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
1164 DCHECK(IsImplThread()); | 1163 DCHECK(IsImplThread()); |
1165 impl().scheduler->NotifyReadyToCommit(); | 1164 impl().scheduler->NotifyReadyToCommit(); |
1166 } | 1165 } |
1167 | 1166 |
1168 void ThreadProxy::DidCommitAndDrawFrame() { | 1167 void ThreadProxy::DidCommitAndDrawFrame() { |
1169 DCHECK(IsMainThread()); | 1168 DCHECK(IsMainThread()); |
1170 layer_tree_host()->DidCommitAndDrawFrame(); | 1169 layer_tree_host()->DidCommitAndDrawFrame(); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 | 1389 |
1391 impl().timing_history.DidActivateSyncTree(); | 1390 impl().timing_history.DidActivateSyncTree(); |
1392 } | 1391 } |
1393 | 1392 |
1394 void ThreadProxy::DidManageTiles() { | 1393 void ThreadProxy::DidManageTiles() { |
1395 DCHECK(IsImplThread()); | 1394 DCHECK(IsImplThread()); |
1396 impl().scheduler->DidManageTiles(); | 1395 impl().scheduler->DidManageTiles(); |
1397 } | 1396 } |
1398 | 1397 |
1399 } // namespace cc | 1398 } // namespace cc |
OLD | NEW |