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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 impl().layer_tree_host_id); | 703 impl().layer_tree_host_id); |
704 impl().timing_history.DidBeginMainFrame(); | 704 impl().timing_history.DidBeginMainFrame(); |
705 } | 705 } |
706 | 706 |
707 void ThreadProxy::BeginMainFrame( | 707 void ThreadProxy::BeginMainFrame( |
708 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { | 708 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { |
709 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); | 709 TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); |
710 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); | 710 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); |
711 DCHECK(IsMainThread()); | 711 DCHECK(IsMainThread()); |
712 | 712 |
713 if (!layer_tree_host()) | |
714 return; | |
715 | |
716 if (main().defer_commits) { | 713 if (main().defer_commits) { |
717 main().pending_deferred_commit = begin_main_frame_state.Pass(); | 714 main().pending_deferred_commit = begin_main_frame_state.Pass(); |
718 layer_tree_host()->DidDeferCommit(); | 715 layer_tree_host()->DidDeferCommit(); |
719 TRACE_EVENT_INSTANT0( | 716 TRACE_EVENT_INSTANT0( |
720 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); | 717 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); |
721 return; | 718 return; |
722 } | 719 } |
723 | 720 |
724 // If the commit finishes, LayerTreeHost will transfer its swap promises to | 721 // If the commit finishes, LayerTreeHost will transfer its swap promises to |
725 // LayerTreeImpl. The destructor of SwapPromiseChecker checks LayerTressHost's | 722 // LayerTreeImpl. The destructor of SwapPromiseChecker checks LayerTressHost's |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame(); | 1176 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame(); |
1180 } | 1177 } |
1181 | 1178 |
1182 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1179 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
1183 DCHECK(IsImplThread()); | 1180 DCHECK(IsImplThread()); |
1184 impl().scheduler->NotifyReadyToCommit(); | 1181 impl().scheduler->NotifyReadyToCommit(); |
1185 } | 1182 } |
1186 | 1183 |
1187 void ThreadProxy::DidCommitAndDrawFrame() { | 1184 void ThreadProxy::DidCommitAndDrawFrame() { |
1188 DCHECK(IsMainThread()); | 1185 DCHECK(IsMainThread()); |
1189 if (!layer_tree_host()) | |
1190 return; | |
1191 layer_tree_host()->DidCommitAndDrawFrame(); | 1186 layer_tree_host()->DidCommitAndDrawFrame(); |
1192 } | 1187 } |
1193 | 1188 |
1194 void ThreadProxy::DidCompleteSwapBuffers() { | 1189 void ThreadProxy::DidCompleteSwapBuffers() { |
1195 DCHECK(IsMainThread()); | 1190 DCHECK(IsMainThread()); |
1196 if (!layer_tree_host()) | |
1197 return; | |
1198 layer_tree_host()->DidCompleteSwapBuffers(); | 1191 layer_tree_host()->DidCompleteSwapBuffers(); |
1199 } | 1192 } |
1200 | 1193 |
1201 void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) { | 1194 void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) { |
1202 TRACE_EVENT0("cc", "ThreadProxy::SetAnimationEvents"); | 1195 TRACE_EVENT0("cc", "ThreadProxy::SetAnimationEvents"); |
1203 DCHECK(IsMainThread()); | 1196 DCHECK(IsMainThread()); |
1204 if (!layer_tree_host()) | |
1205 return; | |
1206 layer_tree_host()->SetAnimationEvents(events.Pass()); | 1197 layer_tree_host()->SetAnimationEvents(events.Pass()); |
1207 } | 1198 } |
1208 | 1199 |
1209 void ThreadProxy::CreateAndInitializeOutputSurface() { | 1200 void ThreadProxy::CreateAndInitializeOutputSurface() { |
1210 TRACE_EVENT0("cc", "ThreadProxy::CreateAndInitializeOutputSurface"); | 1201 TRACE_EVENT0("cc", "ThreadProxy::CreateAndInitializeOutputSurface"); |
1211 DCHECK(IsMainThread()); | 1202 DCHECK(IsMainThread()); |
1212 | 1203 |
1213 // Check that output surface has not been recreated by CompositeAndReadback | 1204 // Check that output surface has not been recreated by CompositeAndReadback |
1214 // after this task is posted but before it is run. | 1205 // after this task is posted but before it is run. |
1215 bool has_initialized_output_surface = true; | 1206 bool has_initialized_output_surface = true; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 | 1498 |
1508 impl().timing_history.DidActivatePendingTree(); | 1499 impl().timing_history.DidActivatePendingTree(); |
1509 } | 1500 } |
1510 | 1501 |
1511 void ThreadProxy::DidManageTiles() { | 1502 void ThreadProxy::DidManageTiles() { |
1512 DCHECK(IsImplThread()); | 1503 DCHECK(IsImplThread()); |
1513 impl().scheduler->DidManageTiles(); | 1504 impl().scheduler->DidManageTiles(); |
1514 } | 1505 } |
1515 | 1506 |
1516 } // namespace cc | 1507 } // namespace cc |
OLD | NEW |