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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 404 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
405 DCHECK(IsImplThread()); | 405 DCHECK(IsImplThread()); |
406 TRACE_EVENT1( | 406 TRACE_EVENT1( |
407 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 407 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
408 scheduler_on_impl_thread_->SetCanDraw(can_draw); | 408 scheduler_on_impl_thread_->SetCanDraw(can_draw); |
409 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( | 409 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( |
410 !scheduler_on_impl_thread_->WillDrawIfNeeded()); | 410 !scheduler_on_impl_thread_->WillDrawIfNeeded()); |
411 } | 411 } |
412 | 412 |
| 413 void ThreadProxy::NotifyReadyToActivate() { |
| 414 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
| 415 scheduler_on_impl_thread_->NotifyReadyToActivate(); |
| 416 } |
| 417 |
413 void ThreadProxy::OnHasPendingTreeStateChanged(bool has_pending_tree) { | 418 void ThreadProxy::OnHasPendingTreeStateChanged(bool has_pending_tree) { |
414 DCHECK(IsImplThread()); | 419 DCHECK(IsImplThread()); |
415 TRACE_EVENT1("cc", "ThreadProxy::OnHasPendingTreeStateChanged", | 420 TRACE_EVENT1("cc", "ThreadProxy::OnHasPendingTreeStateChanged", |
416 "has_pending_tree", has_pending_tree); | 421 "has_pending_tree", has_pending_tree); |
417 scheduler_on_impl_thread_->SetHasPendingTree(has_pending_tree); | 422 scheduler_on_impl_thread_->SetHasTrees( |
| 423 has_pending_tree, |
| 424 layer_tree_host_impl_->active_tree() |
| 425 ? !layer_tree_host_impl_->active_tree()->root_layer() |
| 426 : true); |
418 } | 427 } |
419 | 428 |
420 void ThreadProxy::SetNeedsCommitOnImplThread() { | 429 void ThreadProxy::SetNeedsCommitOnImplThread() { |
421 DCHECK(IsImplThread()); | 430 DCHECK(IsImplThread()); |
422 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 431 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
423 scheduler_on_impl_thread_->SetNeedsCommit(); | 432 scheduler_on_impl_thread_->SetNeedsCommit(); |
424 } | 433 } |
425 | 434 |
426 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 435 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
427 scoped_ptr<AnimationEventsVector> events, | 436 scoped_ptr<AnimationEventsVector> events, |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 // SetVisible kicks off the next scheduler action, so this must be last. | 968 // SetVisible kicks off the next scheduler action, so this must be last. |
960 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 969 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
961 } | 970 } |
962 | 971 |
963 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { | 972 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { |
964 DCHECK(IsImplThread()); | 973 DCHECK(IsImplThread()); |
965 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); | 974 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); |
966 layer_tree_host_impl_->UpdateVisibleTiles(); | 975 layer_tree_host_impl_->UpdateVisibleTiles(); |
967 } | 976 } |
968 | 977 |
969 void ThreadProxy::ScheduledActionActivatePendingTreeIfNeeded() { | 978 void ThreadProxy::ScheduledActionActivatePendingTree() { |
970 DCHECK(IsImplThread()); | 979 DCHECK(IsImplThread()); |
971 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTreeIfNeeded"); | 980 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTree"); |
972 layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); | 981 layer_tree_host_impl_->ActivatePendingTree(); |
973 } | 982 } |
974 | 983 |
975 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 984 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
976 DCHECK(IsImplThread()); | 985 DCHECK(IsImplThread()); |
977 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); | 986 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); |
978 Proxy::MainThreadTaskRunner()->PostTask( | 987 Proxy::MainThreadTaskRunner()->PostTask( |
979 FROM_HERE, | 988 FROM_HERE, |
980 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, | 989 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, |
981 main_thread_weak_ptr_)); | 990 main_thread_weak_ptr_)); |
982 } | 991 } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1526 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1518 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1527 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1519 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1528 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1520 } | 1529 } |
1521 | 1530 |
1522 commit_to_activate_duration_history_.InsertSample( | 1531 commit_to_activate_duration_history_.InsertSample( |
1523 base::TimeTicks::HighResNow() - commit_complete_time_); | 1532 base::TimeTicks::HighResNow() - commit_complete_time_); |
1524 } | 1533 } |
1525 | 1534 |
1526 } // namespace cc | 1535 } // namespace cc |
OLD | NEW |