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 <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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); | 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); |
| 448 DCHECK(IsImplThread()); | 448 DCHECK(IsImplThread()); |
| 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 | |
| 458 // when we draw. | |
| 459 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); | |
| 460 | |
| 461 impl().scheduler->BeginImplFrame(args); | 457 impl().scheduler->BeginImplFrame(args); |
| 462 } | 458 } |
| 463 | 459 |
| 464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 460 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 465 TRACE_EVENT1( | 461 TRACE_EVENT1( |
| 466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 462 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 467 DCHECK(IsImplThread()); | 463 DCHECK(IsImplThread()); |
| 468 impl().scheduler->SetCanDraw(can_draw); | 464 impl().scheduler->SetCanDraw(can_draw); |
| 469 UpdateBackgroundAnimateTicking(); | 465 UpdateBackgroundAnimateTicking(); |
| 470 } | 466 } |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 DCHECK(IsImplThread()); | 760 DCHECK(IsImplThread()); |
| 765 impl().layer_tree_host_impl->FinishAllRendering(); | 761 impl().layer_tree_host_impl->FinishAllRendering(); |
| 766 completion->Signal(); | 762 completion->Signal(); |
| 767 } | 763 } |
| 768 | 764 |
| 769 void ThreadProxy::ScheduledActionSendBeginMainFrame() { | 765 void ThreadProxy::ScheduledActionSendBeginMainFrame() { |
| 770 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginMainFrame"); | 766 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginMainFrame"); |
| 771 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( | 767 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( |
| 772 new BeginMainFrameAndCommitState); | 768 new BeginMainFrameAndCommitState); |
| 773 begin_main_frame_state->monotonic_frame_begin_time = | 769 begin_main_frame_state->monotonic_frame_begin_time = |
| 774 impl().layer_tree_host_impl->CurrentPhysicalTimeTicks(); | 770 impl().layer_tree_host_impl->CurrentFrameTimeTicks(); |
| 775 begin_main_frame_state->scroll_info = | 771 begin_main_frame_state->scroll_info = |
| 776 impl().layer_tree_host_impl->ProcessScrollDeltas(); | 772 impl().layer_tree_host_impl->ProcessScrollDeltas(); |
| 777 | 773 |
| 778 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { | 774 if (!impl().layer_tree_host_impl->settings().impl_side_painting) { |
| 779 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); | 775 DCHECK_GT(impl().layer_tree_host_impl->memory_allocation_limit_bytes(), 0u); |
| 780 } | 776 } |
| 781 begin_main_frame_state->memory_allocation_limit_bytes = | 777 begin_main_frame_state->memory_allocation_limit_bytes = |
| 782 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); | 778 impl().layer_tree_host_impl->memory_allocation_limit_bytes(); |
| 783 begin_main_frame_state->memory_allocation_priority_cutoff = | 779 begin_main_frame_state->memory_allocation_priority_cutoff = |
| 784 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); | 780 impl().layer_tree_host_impl->memory_allocation_priority_cutoff(); |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1384 } | 1380 } |
| 1385 | 1381 |
| 1386 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, | 1382 void ThreadProxy::PostBeginImplFrameDeadline(const base::Closure& closure, |
| 1387 base::TimeTicks deadline) { | 1383 base::TimeTicks deadline) { |
| 1388 base::TimeDelta delta = deadline - gfx::FrameTime::Now(); | 1384 base::TimeDelta delta = deadline - gfx::FrameTime::Now(); |
| 1389 if (delta <= base::TimeDelta()) | 1385 if (delta <= base::TimeDelta()) |
| 1390 delta = base::TimeDelta(); | 1386 delta = base::TimeDelta(); |
| 1391 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); | 1387 Proxy::ImplThreadTaskRunner()->PostDelayedTask(FROM_HERE, closure, delta); |
| 1392 } | 1388 } |
| 1393 | 1389 |
| 1394 void ThreadProxy::DidBeginImplFrameDeadline() { | 1390 void ThreadProxy::DidBeginImplFrameDeadline() { |
|
danakj
2014/03/11 18:32:36
Can this method go away?
| |
| 1395 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame(); | |
| 1396 } | 1391 } |
| 1397 | 1392 |
| 1398 void ThreadProxy::ReadyToFinalizeTextureUpdates() { | 1393 void ThreadProxy::ReadyToFinalizeTextureUpdates() { |
| 1399 DCHECK(IsImplThread()); | 1394 DCHECK(IsImplThread()); |
| 1400 impl().scheduler->NotifyReadyToCommit(); | 1395 impl().scheduler->NotifyReadyToCommit(); |
| 1401 } | 1396 } |
| 1402 | 1397 |
| 1403 void ThreadProxy::DidCommitAndDrawFrame() { | 1398 void ThreadProxy::DidCommitAndDrawFrame() { |
| 1404 DCHECK(IsMainThread()); | 1399 DCHECK(IsMainThread()); |
| 1405 if (!layer_tree_host()) | 1400 if (!layer_tree_host()) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1624 request->completion.Signal(); | 1619 request->completion.Signal(); |
| 1625 } | 1620 } |
| 1626 | 1621 |
| 1627 void ThreadProxy::RenewTreePriority() { | 1622 void ThreadProxy::RenewTreePriority() { |
| 1628 DCHECK(IsImplThread()); | 1623 DCHECK(IsImplThread()); |
| 1629 bool smoothness_takes_priority = | 1624 bool smoothness_takes_priority = |
| 1630 impl().layer_tree_host_impl->pinch_gesture_active() || | 1625 impl().layer_tree_host_impl->pinch_gesture_active() || |
| 1631 impl().layer_tree_host_impl->IsCurrentlyScrolling() || | 1626 impl().layer_tree_host_impl->IsCurrentlyScrolling() || |
| 1632 impl().layer_tree_host_impl->page_scale_animation_active(); | 1627 impl().layer_tree_host_impl->page_scale_animation_active(); |
| 1633 | 1628 |
| 1634 base::TimeTicks now = impl().layer_tree_host_impl->CurrentPhysicalTimeTicks(); | 1629 base::TimeTicks now = gfx::FrameTime::Now(); |
|
danakj
2014/03/11 18:32:36
Why are you using Now here?
| |
| 1635 | 1630 |
| 1636 // Update expiration time if smoothness currently takes priority. | 1631 // Update expiration time if smoothness currently takes priority. |
| 1637 if (smoothness_takes_priority) { | 1632 if (smoothness_takes_priority) { |
| 1638 impl().smoothness_takes_priority_expiration_time = | 1633 impl().smoothness_takes_priority_expiration_time = |
| 1639 now + base::TimeDelta::FromMilliseconds( | 1634 now + base::TimeDelta::FromMilliseconds( |
| 1640 kSmoothnessTakesPriorityExpirationDelay * 1000); | 1635 kSmoothnessTakesPriorityExpirationDelay * 1000); |
| 1641 } | 1636 } |
| 1642 | 1637 |
| 1643 // We use the same priority for both trees by default. | 1638 // We use the same priority for both trees by default. |
| 1644 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; | 1639 TreePriority priority = SAME_PRIORITY_FOR_BOTH_TREES; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1728 | 1723 |
| 1729 impl().timing_history.DidActivatePendingTree(); | 1724 impl().timing_history.DidActivatePendingTree(); |
| 1730 } | 1725 } |
| 1731 | 1726 |
| 1732 void ThreadProxy::DidManageTiles() { | 1727 void ThreadProxy::DidManageTiles() { |
| 1733 DCHECK(IsImplThread()); | 1728 DCHECK(IsImplThread()); |
| 1734 impl().scheduler->DidManageTiles(); | 1729 impl().scheduler->DidManageTiles(); |
| 1735 } | 1730 } |
| 1736 | 1731 |
| 1737 } // namespace cc | 1732 } // namespace cc |
| OLD | NEW |