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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/thread.h" | 10 #include "cc/base/thread.h" |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 // Tell the main thread that the the newly-commited frame was drawn. | 969 // Tell the main thread that the the newly-commited frame was drawn. |
970 if (next_frame_is_newly_committed_frame_on_impl_thread_) { | 970 if (next_frame_is_newly_committed_frame_on_impl_thread_) { |
971 next_frame_is_newly_committed_frame_on_impl_thread_ = false; | 971 next_frame_is_newly_committed_frame_on_impl_thread_ = false; |
972 Proxy::MainThread()->PostTask( | 972 Proxy::MainThread()->PostTask( |
973 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | 973 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); |
974 } | 974 } |
975 | 975 |
976 if (draw_frame) | 976 if (draw_frame) |
977 CheckOutputSurfaceStatusOnImplThread(); | 977 CheckOutputSurfaceStatusOnImplThread(); |
978 | 978 |
979 layer_tree_host_impl_->BeginNextFrame(); | |
980 | |
981 return result; | 979 return result; |
982 } | 980 } |
983 | 981 |
984 void ThreadProxy::AcquireLayerTextures() { | 982 void ThreadProxy::AcquireLayerTextures() { |
985 // Called when the main thread needs to modify a layer texture that is used | 983 // Called when the main thread needs to modify a layer texture that is used |
986 // directly by the compositor. | 984 // directly by the compositor. |
987 // This method will block until the next compositor draw if there is a | 985 // This method will block until the next compositor draw if there is a |
988 // previously committed frame that is still undrawn. This is necessary to | 986 // previously committed frame that is still undrawn. This is necessary to |
989 // ensure that the main thread does not monopolize access to the textures. | 987 // ensure that the main thread does not monopolize access to the textures. |
990 DCHECK(IsMainThread()); | 988 DCHECK(IsMainThread()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 | 1025 |
1028 ScheduledActionDrawAndSwapResult | 1026 ScheduledActionDrawAndSwapResult |
1029 ThreadProxy::ScheduledActionDrawAndSwapForced() { | 1027 ThreadProxy::ScheduledActionDrawAndSwapForced() { |
1030 return ScheduledActionDrawAndSwapInternal(true); | 1028 return ScheduledActionDrawAndSwapInternal(true); |
1031 } | 1029 } |
1032 | 1030 |
1033 void ThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 1031 void ThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
1034 if (current_resource_update_controller_on_impl_thread_) | 1032 if (current_resource_update_controller_on_impl_thread_) |
1035 current_resource_update_controller_on_impl_thread_ | 1033 current_resource_update_controller_on_impl_thread_ |
1036 ->PerformMoreUpdates(time); | 1034 ->PerformMoreUpdates(time); |
| 1035 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |
1037 } | 1036 } |
1038 | 1037 |
1039 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1038 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
1040 DCHECK(IsImplThread()); | 1039 DCHECK(IsImplThread()); |
1041 scheduler_on_impl_thread_->BeginFrameComplete(); | 1040 scheduler_on_impl_thread_->BeginFrameComplete(); |
1042 } | 1041 } |
1043 | 1042 |
1044 void ThreadProxy::DidCommitAndDrawFrame() { | 1043 void ThreadProxy::DidCommitAndDrawFrame() { |
1045 DCHECK(IsMainThread()); | 1044 DCHECK(IsMainThread()); |
1046 if (!layer_tree_host_) | 1045 if (!layer_tree_host_) |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 !layer_tree_host_impl_->pending_tree()) { | 1383 !layer_tree_host_impl_->pending_tree()) { |
1385 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1384 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
1386 TRACE_EVENT_SCOPE_THREAD); | 1385 TRACE_EVENT_SCOPE_THREAD); |
1387 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1386 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1388 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1387 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1389 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1388 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1390 } | 1389 } |
1391 } | 1390 } |
1392 | 1391 |
1393 } // namespace cc | 1392 } // namespace cc |
OLD | NEW |