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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); | 537 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); |
538 scheduler_on_impl_thread_->SetNeedsRedraw(); | 538 scheduler_on_impl_thread_->SetNeedsRedraw(); |
539 } | 539 } |
540 | 540 |
541 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { | 541 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { |
542 DCHECK(IsImplThread()); | 542 DCHECK(IsImplThread()); |
543 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 543 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
544 SetNeedsRedrawOnImplThread(); | 544 SetNeedsRedrawOnImplThread(); |
545 } | 545 } |
546 | 546 |
547 void ThreadProxy::DidSwapUseIncompleteTileOnImplThread() { | 547 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( |
| 548 bool used_incomplete_tile) { |
548 DCHECK(IsImplThread()); | 549 DCHECK(IsImplThread()); |
549 TRACE_EVENT0("cc", "ThreadProxy::DidSwapUseIncompleteTileOnImplThread"); | 550 if (used_incomplete_tile) { |
550 scheduler_on_impl_thread_->DidSwapUseIncompleteTile(); | 551 TRACE_EVENT_INSTANT0( |
| 552 "cc", |
| 553 "ThreadProxy::SetSwapUsedIncompleteTileOnImplThread", |
| 554 TRACE_EVENT_SCOPE_THREAD); |
| 555 } |
| 556 scheduler_on_impl_thread_->SetSwapUsedIncompleteTile( |
| 557 used_incomplete_tile); |
551 } | 558 } |
552 | 559 |
553 void ThreadProxy::DidInitializeVisibleTileOnImplThread() { | 560 void ThreadProxy::DidInitializeVisibleTileOnImplThread() { |
554 DCHECK(IsImplThread()); | 561 DCHECK(IsImplThread()); |
555 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeVisibleTileOnImplThread"); | 562 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeVisibleTileOnImplThread"); |
556 scheduler_on_impl_thread_->SetNeedsRedraw(); | 563 scheduler_on_impl_thread_->SetNeedsRedraw(); |
557 } | 564 } |
558 | 565 |
559 void ThreadProxy::MainThreadHasStoppedFlinging() { | 566 void ThreadProxy::MainThreadHasStoppedFlinging() { |
560 DCHECK(IsMainThread()); | 567 DCHECK(IsMainThread()); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 readback_request_on_impl_thread_->rect); | 1087 readback_request_on_impl_thread_->rect); |
1081 result.did_readback = true; | 1088 result.did_readback = true; |
1082 } | 1089 } |
1083 readback_request_on_impl_thread_->success = result.did_readback; | 1090 readback_request_on_impl_thread_->success = result.did_readback; |
1084 readback_request_on_impl_thread_->completion.Signal(); | 1091 readback_request_on_impl_thread_->completion.Signal(); |
1085 readback_request_on_impl_thread_ = NULL; | 1092 readback_request_on_impl_thread_ = NULL; |
1086 } else if (draw_frame) { | 1093 } else if (draw_frame) { |
1087 DCHECK(swap_requested); | 1094 DCHECK(swap_requested); |
1088 result.did_swap = layer_tree_host_impl_->SwapBuffers(frame); | 1095 result.did_swap = layer_tree_host_impl_->SwapBuffers(frame); |
1089 | 1096 |
1090 if (frame.contains_incomplete_tile) | 1097 // We don't know if we have incomplete tiles if we didn't actually swap. |
1091 DidSwapUseIncompleteTileOnImplThread(); | 1098 if (result.did_swap) { |
| 1099 DCHECK(!frame.has_no_damage); |
| 1100 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); |
| 1101 } |
1092 } | 1102 } |
1093 | 1103 |
1094 // Tell the main thread that the the newly-commited frame was drawn. | 1104 // Tell the main thread that the the newly-commited frame was drawn. |
1095 if (next_frame_is_newly_committed_frame_on_impl_thread_) { | 1105 if (next_frame_is_newly_committed_frame_on_impl_thread_) { |
1096 next_frame_is_newly_committed_frame_on_impl_thread_ = false; | 1106 next_frame_is_newly_committed_frame_on_impl_thread_ = false; |
1097 Proxy::MainThreadTaskRunner()->PostTask( | 1107 Proxy::MainThreadTaskRunner()->PostTask( |
1098 FROM_HERE, | 1108 FROM_HERE, |
1099 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | 1109 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); |
1100 } | 1110 } |
1101 | 1111 |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1550 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1541 } | 1551 } |
1542 | 1552 |
1543 UpdateBackgroundAnimateTicking(); | 1553 UpdateBackgroundAnimateTicking(); |
1544 | 1554 |
1545 commit_to_activate_duration_history_.InsertSample( | 1555 commit_to_activate_duration_history_.InsertSample( |
1546 base::TimeTicks::HighResNow() - commit_complete_time_); | 1556 base::TimeTicks::HighResNow() - commit_complete_time_); |
1547 } | 1557 } |
1548 | 1558 |
1549 } // namespace cc | 1559 } // namespace cc |
OLD | NEW |