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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 | 660 |
661 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { | 661 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { |
662 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); | 662 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); |
663 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( | 663 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( |
664 new BeginFrameAndCommitState); | 664 new BeginFrameAndCommitState); |
665 begin_frame_state->monotonic_frame_begin_time = | 665 begin_frame_state->monotonic_frame_begin_time = |
666 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); | 666 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); |
667 begin_frame_state->scroll_info = | 667 begin_frame_state->scroll_info = |
668 layer_tree_host_impl_->ProcessScrollDeltas(); | 668 layer_tree_host_impl_->ProcessScrollDeltas(); |
669 | 669 |
| 670 if (!begin_frame_state->scroll_info->scrolls.empty()) { |
| 671 TRACE_EVENT_INSTANT0( |
| 672 "impl-scroll", |
| 673 "ThreadProxy::ScheduledActionSendBeginFrameToMainThread received scroll" |
| 674 " deltas", |
| 675 TRACE_EVENT_SCOPE_THREAD); |
| 676 } |
| 677 |
670 if (!layer_tree_host_impl_->settings().impl_side_painting) { | 678 if (!layer_tree_host_impl_->settings().impl_side_painting) { |
671 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); | 679 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); |
672 } | 680 } |
673 begin_frame_state->memory_allocation_limit_bytes = | 681 begin_frame_state->memory_allocation_limit_bytes = |
674 layer_tree_host_impl_->memory_allocation_limit_bytes(); | 682 layer_tree_host_impl_->memory_allocation_limit_bytes(); |
675 Proxy::MainThreadTaskRunner()->PostTask( | 683 Proxy::MainThreadTaskRunner()->PostTask( |
676 FROM_HERE, | 684 FROM_HERE, |
677 base::Bind(&ThreadProxy::BeginFrameOnMainThread, | 685 base::Bind(&ThreadProxy::BeginFrameOnMainThread, |
678 main_thread_weak_ptr_, | 686 main_thread_weak_ptr_, |
679 base::Passed(&begin_frame_state))); | 687 base::Passed(&begin_frame_state))); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); | 727 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
720 bool did_handle = false; | 728 bool did_handle = false; |
721 Proxy::ImplThreadTaskRunner()->PostTask( | 729 Proxy::ImplThreadTaskRunner()->PostTask( |
722 FROM_HERE, | 730 FROM_HERE, |
723 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, | 731 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, |
724 impl_thread_weak_ptr_, | 732 impl_thread_weak_ptr_, |
725 did_handle)); | 733 did_handle)); |
726 return; | 734 return; |
727 } | 735 } |
728 | 736 |
729 if (begin_frame_state) | 737 if (begin_frame_state) { |
| 738 const bool has_scrolls = !begin_frame_state->scroll_info->scrolls.empty(); |
| 739 if (has_scrolls) { |
| 740 // We use async events here because we want to conditionally trace. This |
| 741 // is too spammy otherwise. |
| 742 TRACE_EVENT_ASYNC_BEGIN0( |
| 743 "impl-scroll", |
| 744 "ThreadProxy::BeginFrameOnMainThread", |
| 745 this); |
| 746 } |
730 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); | 747 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); |
| 748 if (has_scrolls) { |
| 749 TRACE_EVENT_ASYNC_END0( |
| 750 "impl-scroll", |
| 751 "ThreadProxy::BeginFrameOnMainThread", |
| 752 this); |
| 753 } |
| 754 } |
731 | 755 |
732 layer_tree_host_->WillBeginFrame(); | 756 layer_tree_host_->WillBeginFrame(); |
733 | 757 |
734 if (begin_frame_state) { | 758 if (begin_frame_state) { |
735 layer_tree_host_->UpdateClientAnimations( | 759 layer_tree_host_->UpdateClientAnimations( |
736 begin_frame_state->monotonic_frame_begin_time); | 760 begin_frame_state->monotonic_frame_begin_time); |
737 layer_tree_host_->AnimateLayers( | 761 layer_tree_host_->AnimateLayers( |
738 begin_frame_state->monotonic_frame_begin_time); | 762 begin_frame_state->monotonic_frame_begin_time); |
739 } | 763 } |
740 | 764 |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1527 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1504 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1528 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1505 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1529 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1506 } | 1530 } |
1507 | 1531 |
1508 commit_to_activate_duration_history_.InsertSample( | 1532 commit_to_activate_duration_history_.InsertSample( |
1509 base::TimeTicks::HighResNow() - commit_complete_time_); | 1533 base::TimeTicks::HighResNow() - commit_complete_time_); |
1510 } | 1534 } |
1511 | 1535 |
1512 } // namespace cc | 1536 } // namespace cc |
OLD | NEW |