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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 } | 678 } |
679 | 679 |
680 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { | 680 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { |
681 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); | 681 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); |
682 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( | 682 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( |
683 new BeginFrameAndCommitState); | 683 new BeginFrameAndCommitState); |
684 begin_frame_state->monotonic_frame_begin_time = | 684 begin_frame_state->monotonic_frame_begin_time = |
685 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); | 685 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); |
686 begin_frame_state->scroll_info = | 686 begin_frame_state->scroll_info = |
687 layer_tree_host_impl_->ProcessScrollDeltas(); | 687 layer_tree_host_impl_->ProcessScrollDeltas(); |
| 688 begin_frame_state->ui_resource_eviction_count = |
| 689 layer_tree_host_impl_->ui_resource_eviction_count(); |
688 | 690 |
689 if (!layer_tree_host_impl_->settings().impl_side_painting) { | 691 if (!layer_tree_host_impl_->settings().impl_side_painting) { |
690 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); | 692 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); |
691 } | 693 } |
692 begin_frame_state->memory_allocation_limit_bytes = | 694 begin_frame_state->memory_allocation_limit_bytes = |
693 layer_tree_host_impl_->memory_allocation_limit_bytes(); | 695 layer_tree_host_impl_->memory_allocation_limit_bytes(); |
694 Proxy::MainThreadTaskRunner()->PostTask( | 696 Proxy::MainThreadTaskRunner()->PostTask( |
695 FROM_HERE, | 697 FROM_HERE, |
696 base::Bind(&ThreadProxy::BeginFrameOnMainThread, | 698 base::Bind(&ThreadProxy::BeginFrameOnMainThread, |
697 main_thread_weak_ptr_, | 699 main_thread_weak_ptr_, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 impl_thread_weak_ptr_, | 746 impl_thread_weak_ptr_, |
745 did_handle)); | 747 did_handle)); |
746 return; | 748 return; |
747 } | 749 } |
748 | 750 |
749 if (begin_frame_state) | 751 if (begin_frame_state) |
750 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); | 752 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); |
751 | 753 |
752 layer_tree_host_->WillBeginFrame(); | 754 layer_tree_host_->WillBeginFrame(); |
753 | 755 |
| 756 bool recreated_evicted_ui_resources = false; |
754 if (begin_frame_state) { | 757 if (begin_frame_state) { |
755 layer_tree_host_->UpdateClientAnimations( | 758 layer_tree_host_->UpdateClientAnimations( |
756 begin_frame_state->monotonic_frame_begin_time); | 759 begin_frame_state->monotonic_frame_begin_time); |
757 layer_tree_host_->AnimateLayers( | 760 layer_tree_host_->AnimateLayers( |
758 begin_frame_state->monotonic_frame_begin_time); | 761 begin_frame_state->monotonic_frame_begin_time); |
| 762 recreated_evicted_ui_resources = |
| 763 layer_tree_host_->SetUIResourceEvictionCount( |
| 764 begin_frame_state->ui_resource_eviction_count); |
759 } | 765 } |
760 | 766 |
761 // Unlink any backings that the impl thread has evicted, so that we know to | 767 // Unlink any backings that the impl thread has evicted, so that we know to |
762 // re-paint them in UpdateLayers. | 768 // re-paint them in UpdateLayers. |
763 if (layer_tree_host_->contents_texture_manager()) { | 769 if (layer_tree_host_->contents_texture_manager()) { |
764 layer_tree_host_->contents_texture_manager()-> | 770 layer_tree_host_->contents_texture_manager()-> |
765 UnlinkAndClearEvictedBackings(); | 771 UnlinkAndClearEvictedBackings(); |
766 } | 772 } |
767 | 773 |
768 layer_tree_host_->Layout(); | 774 layer_tree_host_->Layout(); |
769 | 775 |
770 // Clear the commit flag after updating animations and layout here --- objects | 776 // Clear the commit flag after updating animations and layout here --- objects |
771 // that only layout when painted will trigger another SetNeedsCommit inside | 777 // that only layout when painted will trigger another SetNeedsCommit inside |
772 // UpdateLayers. | 778 // UpdateLayers. |
773 commit_requested_ = false; | 779 commit_requested_ = false; |
774 commit_request_sent_to_impl_thread_ = false; | 780 commit_request_sent_to_impl_thread_ = false; |
775 bool can_cancel_this_commit = | 781 bool can_cancel_this_commit = |
776 can_cancel_commit_ && !in_composite_and_readback_; | 782 can_cancel_commit_ && |
| 783 !in_composite_and_readback_ && |
| 784 !recreated_evicted_ui_resources; |
777 can_cancel_commit_ = true; | 785 can_cancel_commit_ = true; |
778 | 786 |
779 scoped_ptr<ResourceUpdateQueue> queue = | 787 scoped_ptr<ResourceUpdateQueue> queue = |
780 make_scoped_ptr(new ResourceUpdateQueue); | 788 make_scoped_ptr(new ResourceUpdateQueue); |
781 bool updated = layer_tree_host_->UpdateLayers( | 789 bool updated = layer_tree_host_->UpdateLayers( |
782 queue.get(), | 790 queue.get(), |
783 begin_frame_state ? begin_frame_state->memory_allocation_limit_bytes | 791 begin_frame_state ? begin_frame_state->memory_allocation_limit_bytes |
784 : 0u); | 792 : 0u); |
785 | 793 |
786 // Once single buffered layers are committed, they cannot be modified until | 794 // Once single buffered layers are committed, they cannot be modified until |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 layer_tree_host_impl_.reset(); | 1354 layer_tree_host_impl_.reset(); |
1347 weak_factory_on_impl_thread_.InvalidateWeakPtrs(); | 1355 weak_factory_on_impl_thread_.InvalidateWeakPtrs(); |
1348 completion->Signal(); | 1356 completion->Signal(); |
1349 } | 1357 } |
1350 | 1358 |
1351 size_t ThreadProxy::MaxPartialTextureUpdates() const { | 1359 size_t ThreadProxy::MaxPartialTextureUpdates() const { |
1352 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1360 return ResourceUpdateController::MaxPartialTextureUpdates(); |
1353 } | 1361 } |
1354 | 1362 |
1355 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 1363 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
1356 : memory_allocation_limit_bytes(0) {} | 1364 : memory_allocation_limit_bytes(0), |
| 1365 ui_resource_eviction_count(0) {} |
1357 | 1366 |
1358 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} | 1367 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} |
1359 | 1368 |
1360 scoped_ptr<base::Value> ThreadProxy::AsValue() const { | 1369 scoped_ptr<base::Value> ThreadProxy::AsValue() const { |
1361 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1370 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1362 | 1371 |
1363 CompletionEvent completion; | 1372 CompletionEvent completion; |
1364 { | 1373 { |
1365 DebugScopedSetMainThreadBlocked main_thread_blocked( | 1374 DebugScopedSetMainThreadBlocked main_thread_blocked( |
1366 const_cast<ThreadProxy*>(this)); | 1375 const_cast<ThreadProxy*>(this)); |
(...skipping 154 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 |