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