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::OnHasPendingTreeStateChanged(bool has_pending_tree) { | 413 void ThreadProxy::NotifyReadyToActivate() { |
414 DCHECK(IsImplThread()); | 414 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
415 TRACE_EVENT1("cc", "ThreadProxy::OnHasPendingTreeStateChanged", | 415 scheduler_on_impl_thread_->NotifyReadyToActivate(); |
416 "has_pending_tree", has_pending_tree); | |
417 scheduler_on_impl_thread_->SetHasPendingTree(has_pending_tree); | |
418 } | 416 } |
419 | 417 |
420 void ThreadProxy::SetNeedsCommitOnImplThread() { | 418 void ThreadProxy::SetNeedsCommitOnImplThread() { |
421 DCHECK(IsImplThread()); | 419 DCHECK(IsImplThread()); |
422 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 420 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
423 scheduler_on_impl_thread_->SetNeedsCommit(); | 421 scheduler_on_impl_thread_->SetNeedsCommit(); |
424 } | 422 } |
425 | 423 |
426 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 424 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
427 scoped_ptr<AnimationEventsVector> events, | 425 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. | 957 // SetVisible kicks off the next scheduler action, so this must be last. |
960 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 958 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
961 } | 959 } |
962 | 960 |
963 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { | 961 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { |
964 DCHECK(IsImplThread()); | 962 DCHECK(IsImplThread()); |
965 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); | 963 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); |
966 layer_tree_host_impl_->UpdateVisibleTiles(); | 964 layer_tree_host_impl_->UpdateVisibleTiles(); |
967 } | 965 } |
968 | 966 |
969 void ThreadProxy::ScheduledActionActivatePendingTreeIfNeeded() { | 967 void ThreadProxy::ScheduledActionActivatePendingTree() { |
970 DCHECK(IsImplThread()); | 968 DCHECK(IsImplThread()); |
971 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTreeIfNeeded"); | 969 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionActivatePendingTree"); |
972 layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); | 970 layer_tree_host_impl_->ActivatePendingTree(); |
973 } | 971 } |
974 | 972 |
975 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 973 void ThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
976 DCHECK(IsImplThread()); | 974 DCHECK(IsImplThread()); |
977 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); | 975 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionBeginOutputSurfaceCreation"); |
978 Proxy::MainThreadTaskRunner()->PostTask( | 976 Proxy::MainThreadTaskRunner()->PostTask( |
979 FROM_HERE, | 977 FROM_HERE, |
980 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, | 978 base::Bind(&ThreadProxy::CreateAndInitializeOutputSurface, |
981 main_thread_weak_ptr_)); | 979 main_thread_weak_ptr_)); |
982 } | 980 } |
(...skipping 13 matching lines...) Expand all Loading... |
996 | 994 |
997 DCHECK(layer_tree_host_impl_->renderer()); | 995 DCHECK(layer_tree_host_impl_->renderer()); |
998 if (!layer_tree_host_impl_->renderer()) | 996 if (!layer_tree_host_impl_->renderer()) |
999 return result; | 997 return result; |
1000 | 998 |
1001 base::TimeTicks monotonic_time = | 999 base::TimeTicks monotonic_time = |
1002 layer_tree_host_impl_->CurrentFrameTimeTicks(); | 1000 layer_tree_host_impl_->CurrentFrameTimeTicks(); |
1003 base::Time wall_clock_time = layer_tree_host_impl_->CurrentFrameTime(); | 1001 base::Time wall_clock_time = layer_tree_host_impl_->CurrentFrameTime(); |
1004 | 1002 |
1005 // TODO(enne): This should probably happen post-animate. | 1003 // TODO(enne): This should probably happen post-animate. |
1006 if (layer_tree_host_impl_->pending_tree()) { | 1004 if (layer_tree_host_impl_->pending_tree()) |
1007 layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); | 1005 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
1008 if (layer_tree_host_impl_->pending_tree()) | |
1009 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); | |
1010 } | |
1011 layer_tree_host_impl_->Animate(monotonic_time, wall_clock_time); | 1006 layer_tree_host_impl_->Animate(monotonic_time, wall_clock_time); |
1012 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(false); | 1007 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(false); |
1013 | 1008 |
1014 base::TimeTicks start_time = base::TimeTicks::HighResNow(); | 1009 base::TimeTicks start_time = base::TimeTicks::HighResNow(); |
1015 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); | 1010 base::TimeDelta draw_duration_estimate = DrawDurationEstimate(); |
1016 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 1011 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
1017 | 1012 |
1018 // This method is called on a forced draw, regardless of whether we are able | 1013 // This method is called on a forced draw, regardless of whether we are able |
1019 // to produce a frame, as the calling site on main thread is blocked until its | 1014 // to produce a frame, as the calling site on main thread is blocked until its |
1020 // request completes, and we signal completion here. If CanDraw() is false, we | 1015 // request completes, and we signal completion here. If CanDraw() is false, we |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1512 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1518 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1513 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1519 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1514 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1520 } | 1515 } |
1521 | 1516 |
1522 commit_to_activate_duration_history_.InsertSample( | 1517 commit_to_activate_duration_history_.InsertSample( |
1523 base::TimeTicks::HighResNow() - commit_complete_time_); | 1518 base::TimeTicks::HighResNow() - commit_complete_time_); |
1524 } | 1519 } |
1525 | 1520 |
1526 } // namespace cc | 1521 } // namespace cc |
OLD | NEW |