| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 754 if (begin_frame_state) { | 756 if (begin_frame_state) { |
| 755 layer_tree_host_->UpdateClientAnimations( | 757 layer_tree_host_->UpdateClientAnimations( |
| 756 begin_frame_state->monotonic_frame_begin_time); | 758 begin_frame_state->monotonic_frame_begin_time); |
| 757 layer_tree_host_->AnimateLayers( | 759 layer_tree_host_->AnimateLayers( |
| 758 begin_frame_state->monotonic_frame_begin_time); | 760 begin_frame_state->monotonic_frame_begin_time); |
| 761 layer_tree_host_->SetUIResourceEvictionCountToAck( |
| 762 begin_frame_state->ui_resource_eviction_count); |
| 759 } | 763 } |
| 760 | 764 |
| 761 // Unlink any backings that the impl thread has evicted, so that we know to | 765 // Unlink any backings that the impl thread has evicted, so that we know to |
| 762 // re-paint them in UpdateLayers. | 766 // re-paint them in UpdateLayers. |
| 763 if (layer_tree_host_->contents_texture_manager()) { | 767 if (layer_tree_host_->contents_texture_manager()) { |
| 764 layer_tree_host_->contents_texture_manager()-> | 768 layer_tree_host_->contents_texture_manager()-> |
| 765 UnlinkAndClearEvictedBackings(); | 769 UnlinkAndClearEvictedBackings(); |
| 766 } | 770 } |
| 767 | 771 |
| 768 layer_tree_host_->Layout(); | 772 layer_tree_host_->Layout(); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 layer_tree_host_impl_.reset(); | 1350 layer_tree_host_impl_.reset(); |
| 1347 weak_factory_on_impl_thread_.InvalidateWeakPtrs(); | 1351 weak_factory_on_impl_thread_.InvalidateWeakPtrs(); |
| 1348 completion->Signal(); | 1352 completion->Signal(); |
| 1349 } | 1353 } |
| 1350 | 1354 |
| 1351 size_t ThreadProxy::MaxPartialTextureUpdates() const { | 1355 size_t ThreadProxy::MaxPartialTextureUpdates() const { |
| 1352 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1356 return ResourceUpdateController::MaxPartialTextureUpdates(); |
| 1353 } | 1357 } |
| 1354 | 1358 |
| 1355 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 1359 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
| 1356 : memory_allocation_limit_bytes(0) {} | 1360 : memory_allocation_limit_bytes(0), |
| 1361 ui_resource_eviction_count(0) {} |
| 1357 | 1362 |
| 1358 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} | 1363 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} |
| 1359 | 1364 |
| 1360 scoped_ptr<base::Value> ThreadProxy::AsValue() const { | 1365 scoped_ptr<base::Value> ThreadProxy::AsValue() const { |
| 1361 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1366 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1362 | 1367 |
| 1363 CompletionEvent completion; | 1368 CompletionEvent completion; |
| 1364 { | 1369 { |
| 1365 DebugScopedSetMainThreadBlocked main_thread_blocked( | 1370 DebugScopedSetMainThreadBlocked main_thread_blocked( |
| 1366 const_cast<ThreadProxy*>(this)); | 1371 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; | 1526 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1522 } | 1527 } |
| 1523 | 1528 |
| 1524 UpdateBackgroundAnimateTicking(); | 1529 UpdateBackgroundAnimateTicking(); |
| 1525 | 1530 |
| 1526 commit_to_activate_duration_history_.InsertSample( | 1531 commit_to_activate_duration_history_.InsertSample( |
| 1527 base::TimeTicks::HighResNow() - commit_complete_time_); | 1532 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1528 } | 1533 } |
| 1529 | 1534 |
| 1530 } // namespace cc | 1535 } // namespace cc |
| OLD | NEW |