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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 | 628 |
629 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { | 629 void ThreadProxy::ScheduledActionSendBeginFrameToMainThread() { |
630 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); | 630 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginFrameToMainThread"); |
631 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( | 631 scoped_ptr<BeginFrameAndCommitState> begin_frame_state( |
632 new BeginFrameAndCommitState); | 632 new BeginFrameAndCommitState); |
633 begin_frame_state->monotonic_frame_begin_time = | 633 begin_frame_state->monotonic_frame_begin_time = |
634 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); | 634 layer_tree_host_impl_->CurrentPhysicalTimeTicks(); |
635 begin_frame_state->scroll_info = | 635 begin_frame_state->scroll_info = |
636 layer_tree_host_impl_->ProcessScrollDeltas(); | 636 layer_tree_host_impl_->ProcessScrollDeltas(); |
637 | 637 |
638 if (!begin_frame_state->scroll_info->scrolls.empty()) { | |
639 TRACE_EVENT_INSTANT0( | |
640 "impl-scroll", | |
641 "ThreadProxy::ScheduledActionSendBeginFrameToMainThread received scroll" | |
642 " deltas", | |
643 TRACE_EVENT_SCOPE_THREAD); | |
644 } | |
645 | |
638 if (!layer_tree_host_impl_->settings().impl_side_painting) { | 646 if (!layer_tree_host_impl_->settings().impl_side_painting) { |
639 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); | 647 DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); |
640 } | 648 } |
641 begin_frame_state->memory_allocation_limit_bytes = | 649 begin_frame_state->memory_allocation_limit_bytes = |
642 layer_tree_host_impl_->memory_allocation_limit_bytes(); | 650 layer_tree_host_impl_->memory_allocation_limit_bytes(); |
643 Proxy::MainThreadTaskRunner()->PostTask( | 651 Proxy::MainThreadTaskRunner()->PostTask( |
644 FROM_HERE, | 652 FROM_HERE, |
645 base::Bind(&ThreadProxy::BeginFrameOnMainThread, | 653 base::Bind(&ThreadProxy::BeginFrameOnMainThread, |
646 main_thread_weak_ptr_, | 654 main_thread_weak_ptr_, |
647 base::Passed(&begin_frame_state))); | 655 base::Passed(&begin_frame_state))); |
(...skipping 25 matching lines...) Expand all Loading... | |
673 // the paint, commit_requested_ will be set to false to allow new commit | 681 // the paint, commit_requested_ will be set to false to allow new commit |
674 // requests to be scheduled. | 682 // requests to be scheduled. |
675 commit_requested_ = true; | 683 commit_requested_ = true; |
676 commit_request_sent_to_impl_thread_ = true; | 684 commit_request_sent_to_impl_thread_ = true; |
677 | 685 |
678 // On the other hand, the AnimationRequested flag needs to be cleared | 686 // On the other hand, the AnimationRequested flag needs to be cleared |
679 // here so that any animation requests generated by the apply or animate | 687 // here so that any animation requests generated by the apply or animate |
680 // callbacks will trigger another frame. | 688 // callbacks will trigger another frame. |
681 animate_requested_ = false; | 689 animate_requested_ = false; |
682 | 690 |
683 if (begin_frame_state) | 691 if (begin_frame_state) { |
692 const bool has_scrolls = !begin_frame_state->scroll_info->scrolls.empty(); | |
693 if (has_scrolls) { | |
694 // We use async events here because we want to conditionally trace. This | |
695 // is too spammy otherwise. | |
696 TRACE_EVENT_ASYNC_BEGIN0( | |
697 "impl-scroll", | |
698 "ThreadProxy::BeginFrameOnMainThread", | |
danakj
2013/07/29 17:16:08
You have a trace event in ApplyScrollAndScale, and
| |
699 this); | |
700 } | |
684 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); | 701 layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); |
702 if (has_scrolls) { | |
703 TRACE_EVENT_ASYNC_END0( | |
704 "impl-scroll", | |
705 "ThreadProxy::BeginFrameOnMainThread", | |
706 this); | |
707 } | |
708 } | |
685 | 709 |
686 if (!in_composite_and_readback_ && !layer_tree_host_->visible()) { | 710 if (!in_composite_and_readback_ && !layer_tree_host_->visible()) { |
687 commit_requested_ = false; | 711 commit_requested_ = false; |
688 commit_request_sent_to_impl_thread_ = false; | 712 commit_request_sent_to_impl_thread_ = false; |
689 | 713 |
690 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); | 714 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
691 Proxy::ImplThreadTaskRunner()->PostTask( | 715 Proxy::ImplThreadTaskRunner()->PostTask( |
692 FROM_HERE, | 716 FROM_HERE, |
693 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, | 717 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, |
694 impl_thread_weak_ptr_)); | 718 impl_thread_weak_ptr_)); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1435 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1459 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1436 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1460 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1437 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1461 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1438 } | 1462 } |
1439 | 1463 |
1440 commit_to_activate_duration_history_.InsertSample( | 1464 commit_to_activate_duration_history_.InsertSample( |
1441 base::TimeTicks::HighResNow() - commit_complete_time_); | 1465 base::TimeTicks::HighResNow() - commit_complete_time_); |
1442 } | 1466 } |
1443 | 1467 |
1444 } // namespace cc | 1468 } // namespace cc |
OLD | NEW |