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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); | 542 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); |
543 scheduler_on_impl_thread_->SetNeedsRedraw(); | 543 scheduler_on_impl_thread_->SetNeedsRedraw(); |
544 } | 544 } |
545 | 545 |
546 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { | 546 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { |
547 DCHECK(IsImplThread()); | 547 DCHECK(IsImplThread()); |
548 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 548 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
549 SetNeedsRedrawOnImplThread(); | 549 SetNeedsRedrawOnImplThread(); |
550 } | 550 } |
551 | 551 |
552 void ThreadProxy::DidSwapUseIncompleteTileOnImplThread() { | 552 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( |
| 553 bool used_incomplete_tile) { |
553 DCHECK(IsImplThread()); | 554 DCHECK(IsImplThread()); |
554 TRACE_EVENT0("cc", "ThreadProxy::DidSwapUseIncompleteTileOnImplThread"); | 555 if (used_incomplete_tile) { |
555 scheduler_on_impl_thread_->DidSwapUseIncompleteTile(); | 556 TRACE_EVENT_INSTANT0( |
| 557 "cc", |
| 558 "ThreadProxy::SetSwapUsedIncompleteTileOnImplThread", |
| 559 TRACE_EVENT_SCOPE_THREAD); |
| 560 } |
| 561 scheduler_on_impl_thread_->SetSwapUsedIncompleteTile( |
| 562 used_incomplete_tile); |
556 } | 563 } |
557 | 564 |
558 void ThreadProxy::DidInitializeVisibleTileOnImplThread() { | 565 void ThreadProxy::DidInitializeVisibleTileOnImplThread() { |
559 DCHECK(IsImplThread()); | 566 DCHECK(IsImplThread()); |
560 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeVisibleTileOnImplThread"); | 567 TRACE_EVENT0("cc", "ThreadProxy::DidInitializeVisibleTileOnImplThread"); |
561 scheduler_on_impl_thread_->SetNeedsRedraw(); | 568 scheduler_on_impl_thread_->SetNeedsRedraw(); |
562 } | 569 } |
563 | 570 |
564 void ThreadProxy::MainThreadHasStoppedFlinging() { | 571 void ThreadProxy::MainThreadHasStoppedFlinging() { |
565 DCHECK(IsMainThread()); | 572 DCHECK(IsMainThread()); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 layer_tree_host_impl_->Readback(readback_request_on_impl_thread_->pixels, | 1087 layer_tree_host_impl_->Readback(readback_request_on_impl_thread_->pixels, |
1081 readback_request_on_impl_thread_->rect); | 1088 readback_request_on_impl_thread_->rect); |
1082 readback_request_on_impl_thread_->success = | 1089 readback_request_on_impl_thread_->success = |
1083 !layer_tree_host_impl_->IsContextLost(); | 1090 !layer_tree_host_impl_->IsContextLost(); |
1084 } | 1091 } |
1085 readback_request_on_impl_thread_->completion.Signal(); | 1092 readback_request_on_impl_thread_->completion.Signal(); |
1086 readback_request_on_impl_thread_ = NULL; | 1093 readback_request_on_impl_thread_ = NULL; |
1087 } else if (draw_frame) { | 1094 } else if (draw_frame) { |
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 if (result.did_swap) { |
1091 DidSwapUseIncompleteTileOnImplThread(); | 1098 DCHECK(!frame.has_no_damage); |
| 1099 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); |
| 1100 } |
1092 } | 1101 } |
1093 | 1102 |
1094 // Tell the main thread that the the newly-commited frame was drawn. | 1103 // Tell the main thread that the the newly-commited frame was drawn. |
1095 if (next_frame_is_newly_committed_frame_on_impl_thread_) { | 1104 if (next_frame_is_newly_committed_frame_on_impl_thread_) { |
1096 next_frame_is_newly_committed_frame_on_impl_thread_ = false; | 1105 next_frame_is_newly_committed_frame_on_impl_thread_ = false; |
1097 Proxy::MainThreadTaskRunner()->PostTask( | 1106 Proxy::MainThreadTaskRunner()->PostTask( |
1098 FROM_HERE, | 1107 FROM_HERE, |
1099 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | 1108 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); |
1100 } | 1109 } |
1101 | 1110 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1530 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1522 } | 1531 } |
1523 | 1532 |
1524 UpdateBackgroundAnimateTicking(); | 1533 UpdateBackgroundAnimateTicking(); |
1525 | 1534 |
1526 commit_to_activate_duration_history_.InsertSample( | 1535 commit_to_activate_duration_history_.InsertSample( |
1527 base::TimeTicks::HighResNow() - commit_complete_time_); | 1536 base::TimeTicks::HighResNow() - commit_complete_time_); |
1528 } | 1537 } |
1529 | 1538 |
1530 } // namespace cc | 1539 } // namespace cc |
OLD | NEW |