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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); | 449 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); |
450 UpdateBackgroundAnimateTicking(); | 450 UpdateBackgroundAnimateTicking(); |
451 } | 451 } |
452 | 452 |
453 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { | 453 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { |
454 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); | 454 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); |
455 DCHECK(IsImplThread()); | 455 DCHECK(IsImplThread()); |
456 | 456 |
457 // Sample the frame time now. This time will be used for updating animations | 457 // Sample the frame time now. This time will be used for updating animations |
458 // when we draw. | 458 // when we draw. |
459 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); | 459 impl().layer_tree_host_impl->UpdateCurrentFrameTime(); |
460 | 460 |
461 impl().scheduler->BeginImplFrame(args); | 461 impl().scheduler->BeginImplFrame(args); |
462 } | 462 } |
463 | 463 |
464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
465 TRACE_EVENT1( | 465 TRACE_EVENT1( |
466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
467 DCHECK(IsImplThread()); | 467 DCHECK(IsImplThread()); |
468 impl().scheduler->SetCanDraw(can_draw); | 468 impl().scheduler->SetCanDraw(can_draw); |
469 UpdateBackgroundAnimateTicking(); | 469 UpdateBackgroundAnimateTicking(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 DCHECK(IsImplThread()); | 764 DCHECK(IsImplThread()); |
765 impl().layer_tree_host_impl->FinishAllRendering(); | 765 impl().layer_tree_host_impl->FinishAllRendering(); |
766 completion->Signal(); | 766 completion->Signal(); |
767 } | 767 } |
768 | 768 |
769 void ThreadProxy::ScheduledActionSendBeginMainFrame() { | 769 void ThreadProxy::ScheduledActionSendBeginMainFrame() { |
770 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginMainFrame"); | 770 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginMainFrame"); |
771 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( | 771 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( |
772 new BeginMainFrameAndCommitState); | 772 new BeginMainFrameAndCommitState); |
773 begin_main_frame_state->monotonic_frame_begin_time = | 773 begin_main_frame_state->monotonic_frame_begin_time = |
774 impl().layer_tree_host_impl->CurrentPhysicalTimeTicks(); | 774 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
775 begin_main_frame_state->scroll_info = | 775 begin_main_frame_state->scroll_info = |
776 impl().layer_tree_host_impl->ProcessScrollDeltas(); | 776 impl().layer_tree_host_impl->ProcessScrollDeltas(); |
777 | 777 |
778 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 778 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
779 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 779 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
780 } | 780 } |
781 begin_main_frame_state->memory_allocation_limit_bytes = | 781 begin_main_frame_state->memory_allocation_limit_bytes = |
782 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 782 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
783 begin_main_frame_state->memory_allocation_priority_cutoff = | 783 begin_main_frame_state->memory_allocation_priority_cutoff = |
784 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 784 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 request->completion.Signal(); | 1622 request->completion.Signal(); |
1623 } | 1623 } |
1624 | 1624 |
1625 void ThreadProxy::RenewTreePriority() { | 1625 void ThreadProxy::RenewTreePriority() { |
1626 DCHECK(IsImplThread()); | 1626 DCHECK(IsImplThread()); |
1627 bool smoothness_takes_priority = | 1627 bool smoothness_takes_priority = |
1628 impl().layer_tree_host_impl->pinch_gesture_active() || | 1628 impl().layer_tree_host_impl->pinch_gesture_active() || |
1629 impl().layer_tree_host_impl->IsCurrentlyScrolling() || | 1629 impl().layer_tree_host_impl->IsCurrentlyScrolling() || |
1630 impl().layer_tree_host_impl->page_scale_animation_active(); | 1630 impl().layer_tree_host_impl->page_scale_animation_active(); |
1631 | 1631 |
1632 base::TimeTicks now = impl().layer_tree_host_impl->CurrentPhysicalTimeTicks(); | 1632 base::TimeTicks now = impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
1633 | 1633 |
1634 // Update expiration time if smoothness currently takes priority. | 1634 // Update expiration time if smoothness currently takes priority. |
1635 if (smoothness_takes_priority) { | 1635 if (smoothness_takes_priority) { |
1636 impl().smoothness_takes_priority_expiration_time = | 1636 impl().smoothness_takes_priority_expiration_time = |
1637 now + base::TimeDelta::FromMilliseconds( | 1637 now + base::TimeDelta::FromMilliseconds( |
1638 kSmoothnessTakesPriorityExpirationDelay * 1000); | 1638 kSmoothnessTakesPriorityExpirationDelay * 1000); |
1639 } | 1639 } |
1640 | 1640 |
1641 // We use the same priority for both trees by default. | 1641 // We use the same priority for both trees by default. |
1642 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; | 1642 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 | 1726 |
1727 impl().timing_history.DidActivatePendingTree(); | 1727 impl().timing_history.DidActivatePendingTree(); |
1728 } | 1728 } |
1729 | 1729 |
1730 void ThreadProxy::DidManageTiles() { | 1730 void ThreadProxy::DidManageTiles() { |
1731 DCHECK(IsImplThread()); | 1731 DCHECK(IsImplThread()); |
1732 impl().scheduler->DidManageTiles(); | 1732 impl().scheduler->DidManageTiles(); |
1733 } | 1733 } |
1734 | 1734 |
1735 } // namespace cc | 1735 } // namespace cc |
OLD | NEW |