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