| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 DCHECK(IsImplThread()); | 479 DCHECK(IsImplThread()); |
| 480 impl().scheduler->SetNeedsManageTiles(); | 480 impl().scheduler->SetNeedsManageTiles(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { | 483 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
| 484 DCHECK(IsImplThread()); | 484 DCHECK(IsImplThread()); |
| 485 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); | 485 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); |
| 486 SetNeedsRedrawOnImplThread(); | 486 SetNeedsRedrawOnImplThread(); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( | |
| 490 bool used_incomplete_tile) { | |
| 491 DCHECK(IsImplThread()); | |
| 492 if (used_incomplete_tile) { | |
| 493 TRACE_EVENT_INSTANT0("cc", | |
| 494 "ThreadProxy::SetSwapUsedIncompleteTileOnImplThread", | |
| 495 TRACE_EVENT_SCOPE_THREAD); | |
| 496 } | |
| 497 impl().scheduler->SetSwapUsedIncompleteTile(used_incomplete_tile); | |
| 498 } | |
| 499 | |
| 500 void ThreadProxy::DidInitializeVisibleTileOnImplThread() { | |
| 501 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeVisibleTileOnImplThread"); | |
| 502 DCHECK(IsImplThread()); | |
| 503 impl().scheduler->SetNeedsRedraw(); | |
| 504 } | |
| 505 | |
| 506 void ThreadProxy::MainThreadHasStoppedFlinging() { | 489 void ThreadProxy::MainThreadHasStoppedFlinging() { |
| 507 DCHECK(IsMainThread()); | 490 DCHECK(IsMainThread()); |
| 508 Proxy::ImplThreadTaskRunner()->PostTask( | 491 Proxy::ImplThreadTaskRunner()->PostTask( |
| 509 FROM_HERE, | 492 FROM_HERE, |
| 510 base::Bind(&ThreadProxy::MainThreadHasStoppedFlingingOnImplThread, | 493 base::Bind(&ThreadProxy::MainThreadHasStoppedFlingingOnImplThread, |
| 511 impl_thread_weak_ptr_)); | 494 impl_thread_weak_ptr_)); |
| 512 } | 495 } |
| 513 | 496 |
| 514 void ThreadProxy::MainThreadHasStoppedFlingingOnImplThread() { | 497 void ThreadProxy::MainThreadHasStoppedFlingingOnImplThread() { |
| 515 DCHECK(IsImplThread()); | 498 DCHECK(IsImplThread()); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 | 967 |
| 985 SetInputThrottledUntilCommitOnImplThread(false); | 968 SetInputThrottledUntilCommitOnImplThread(false); |
| 986 | 969 |
| 987 UpdateBackgroundAnimateTicking(); | 970 UpdateBackgroundAnimateTicking(); |
| 988 | 971 |
| 989 impl().next_frame_is_newly_committed_frame = true; | 972 impl().next_frame_is_newly_committed_frame = true; |
| 990 | 973 |
| 991 impl().timing_history.DidCommit(); | 974 impl().timing_history.DidCommit(); |
| 992 } | 975 } |
| 993 | 976 |
| 994 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { | |
| 995 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); | |
| 996 DCHECK(IsImplThread()); | |
| 997 impl().layer_tree_host_impl->UpdateVisibleTiles(); | |
| 998 } | |
| 999 | |
| 1000 void ThreadProxy::ScheduledActionActivateSyncTree() { | 977 void ThreadProxy::ScheduledActionActivateSyncTree() { |
| 1001 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); | 978 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivateSyncTree"); |
| 1002 DCHECK(IsImplThread()); | 979 DCHECK(IsImplThread()); |
| 1003 impl().layer_tree_host_impl->ActivateSyncTree(); | 980 impl().layer_tree_host_impl->ActivateSyncTree(); |
| 1004 } | 981 } |
| 1005 | 982 |
| 1006 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 983 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
| 1007 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); | 984 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); |
| 1008 DCHECK(IsImplThread()); | 985 DCHECK(IsImplThread()); |
| 1009 Proxy::MainThreadTaskRunner()->PostTask( | 986 Proxy::MainThreadTaskRunner()->PostTask( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 &frame, impl().scheduler->LastBeginImplFrameTime()); | 1027 &frame, impl().scheduler->LastBeginImplFrameTime()); |
| 1051 result = DRAW_SUCCESS; | 1028 result = DRAW_SUCCESS; |
| 1052 } else { | 1029 } else { |
| 1053 DCHECK_NE(DRAW_SUCCESS, result); | 1030 DCHECK_NE(DRAW_SUCCESS, result); |
| 1054 } | 1031 } |
| 1055 impl().layer_tree_host_impl->DidDrawAllLayers(frame); | 1032 impl().layer_tree_host_impl->DidDrawAllLayers(frame); |
| 1056 | 1033 |
| 1057 bool start_ready_animations = draw_frame; | 1034 bool start_ready_animations = draw_frame; |
| 1058 impl().layer_tree_host_impl->UpdateAnimationState(start_ready_animations); | 1035 impl().layer_tree_host_impl->UpdateAnimationState(start_ready_animations); |
| 1059 | 1036 |
| 1060 if (draw_frame) { | 1037 if (draw_frame) |
| 1061 bool did_request_swap = impl().layer_tree_host_impl->SwapBuffers(frame); | 1038 impl().layer_tree_host_impl->SwapBuffers(frame); |
| 1062 | |
| 1063 // We don't know if we have incomplete tiles if we didn't actually swap. | |
| 1064 if (did_request_swap) { | |
| 1065 DCHECK(!frame.has_no_damage); | |
| 1066 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); | |
| 1067 } | |
| 1068 } | |
| 1069 | 1039 |
| 1070 // Tell the main thread that the the newly-commited frame was drawn. | 1040 // Tell the main thread that the the newly-commited frame was drawn. |
| 1071 if (impl().next_frame_is_newly_committed_frame) { | 1041 if (impl().next_frame_is_newly_committed_frame) { |
| 1072 impl().next_frame_is_newly_committed_frame = false; | 1042 impl().next_frame_is_newly_committed_frame = false; |
| 1073 Proxy::MainThreadTaskRunner()->PostTask( | 1043 Proxy::MainThreadTaskRunner()->PostTask( |
| 1074 FROM_HERE, | 1044 FROM_HERE, |
| 1075 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | 1045 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); |
| 1076 } | 1046 } |
| 1077 | 1047 |
| 1078 if (result == DRAW_SUCCESS) | 1048 if (result == DRAW_SUCCESS) |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 | 1337 |
| 1368 impl().timing_history.DidActivateSyncTree(); | 1338 impl().timing_history.DidActivateSyncTree(); |
| 1369 } | 1339 } |
| 1370 | 1340 |
| 1371 void ThreadProxy::DidManageTiles() { | 1341 void ThreadProxy::DidManageTiles() { |
| 1372 DCHECK(IsImplThread()); | 1342 DCHECK(IsImplThread()); |
| 1373 impl().scheduler->DidManageTiles(); | 1343 impl().scheduler->DidManageTiles(); |
| 1374 } | 1344 } |
| 1375 | 1345 |
| 1376 } // namespace cc | 1346 } // namespace cc |
| OLD | NEW |