Chromium Code Reviews| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 } | 426 } |
| 427 | 427 |
| 428 void ThreadProxy::OnHasPendingTreeStateChanged(bool has_pending_tree) { | 428 void ThreadProxy::OnHasPendingTreeStateChanged(bool has_pending_tree) { |
| 429 DCHECK(IsImplThread()); | 429 DCHECK(IsImplThread()); |
| 430 TRACE_EVENT1("cc", "ThreadProxy::OnHasPendingTreeStateChanged", | 430 TRACE_EVENT1("cc", "ThreadProxy::OnHasPendingTreeStateChanged", |
| 431 "has_pending_tree", has_pending_tree); | 431 "has_pending_tree", has_pending_tree); |
| 432 scheduler_on_impl_thread_->SetHasTrees( | 432 scheduler_on_impl_thread_->SetHasTrees( |
| 433 has_pending_tree, | 433 has_pending_tree, |
| 434 layer_tree_host_impl_->active_tree() ? | 434 layer_tree_host_impl_->active_tree() ? |
| 435 !layer_tree_host_impl_->active_tree()->root_layer() : true); | 435 !layer_tree_host_impl_->active_tree()->root_layer() : true); |
| 436 | |
| 437 if (!has_pending_tree && !deferred_start_commit_on_impl_thread_.is_null()) { | |
| 438 Proxy::ImplThreadTaskRunner()->PostTask( | |
| 439 FROM_HERE, | |
| 440 deferred_start_commit_on_impl_thread_); | |
| 441 deferred_start_commit_on_impl_thread_.Reset(); | |
| 442 } | |
| 436 } | 443 } |
| 437 | 444 |
| 438 void ThreadProxy::SetNeedsCommitOnImplThread() { | 445 void ThreadProxy::SetNeedsCommitOnImplThread() { |
| 439 DCHECK(IsImplThread()); | 446 DCHECK(IsImplThread()); |
| 440 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 447 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
| 441 scheduler_on_impl_thread_->SetNeedsCommit(); | 448 scheduler_on_impl_thread_->SetNeedsCommit(); |
| 442 } | 449 } |
| 443 | 450 |
| 444 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 451 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
| 445 scoped_ptr<AnimationEventsVector> events, | 452 scoped_ptr<AnimationEventsVector> events, |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 DCHECK(scheduler_on_impl_thread_); | 880 DCHECK(scheduler_on_impl_thread_); |
| 874 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 881 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
| 875 | 882 |
| 876 if (!layer_tree_host_impl_) { | 883 if (!layer_tree_host_impl_) { |
| 877 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); | 884 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); |
| 878 completion->Signal(); | 885 completion->Signal(); |
| 879 | 886 |
| 880 return; | 887 return; |
| 881 } | 888 } |
| 882 | 889 |
| 890 // We defer forced commits while there is a pending tree here. | |
|
Sami
2013/08/13 15:56:02
Could this be done in the state machine instead? S
brianderson
2013/09/07 01:18:54
Hmm, I'll give that a try. I did it this way becau
| |
| 891 if (layer_tree_host_impl_->pending_tree()) { | |
| 892 TRACE_EVENT0("cc", "EarlyOut_DeferringDueToPendingTree"); | |
| 893 DCHECK(deferred_start_commit_on_impl_thread_.is_null()); | |
| 894 deferred_start_commit_on_impl_thread_ = | |
| 895 base::Bind(&ThreadProxy::StartCommitOnImplThread, | |
| 896 impl_thread_weak_ptr_, | |
| 897 completion, | |
| 898 raw_queue, | |
| 899 offscreen_context_provider); | |
| 900 return; | |
| 901 } | |
| 902 | |
| 883 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); | 903 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); |
| 884 | 904 |
| 885 if (offscreen_context_provider.get()) | 905 if (offscreen_context_provider.get()) |
| 886 offscreen_context_provider->BindToCurrentThread(); | 906 offscreen_context_provider->BindToCurrentThread(); |
| 887 layer_tree_host_impl_->resource_provider()-> | 907 layer_tree_host_impl_->resource_provider()-> |
| 888 set_offscreen_context_provider(offscreen_context_provider); | 908 set_offscreen_context_provider(offscreen_context_provider); |
| 889 | 909 |
| 890 if (layer_tree_host_->contents_texture_manager()) { | 910 if (layer_tree_host_->contents_texture_manager()) { |
| 891 if (layer_tree_host_->contents_texture_manager()-> | 911 if (layer_tree_host_->contents_texture_manager()-> |
| 892 LinkedEvictedBackingsExist()) { | 912 LinkedEvictedBackingsExist()) { |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1543 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1563 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 1544 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1564 completion_event_for_commit_held_on_tree_activation_->Signal(); |
| 1545 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1565 completion_event_for_commit_held_on_tree_activation_ = NULL; |
| 1546 } | 1566 } |
| 1547 | 1567 |
| 1548 commit_to_activate_duration_history_.InsertSample( | 1568 commit_to_activate_duration_history_.InsertSample( |
| 1549 base::TimeTicks::HighResNow() - commit_complete_time_); | 1569 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1550 } | 1570 } |
| 1551 | 1571 |
| 1552 } // namespace cc | 1572 } // namespace cc |
| OLD | NEW |