| 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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 | 1004 |
| 1005 if (did_handle) | 1005 if (did_handle) |
| 1006 SetInputThrottledUntilCommitOnImplThread(false); | 1006 SetInputThrottledUntilCommitOnImplThread(false); |
| 1007 layer_tree_host_impl_->BeginMainFrameAborted(did_handle); | 1007 layer_tree_host_impl_->BeginMainFrameAborted(did_handle); |
| 1008 scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle); | 1008 scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 void ThreadProxy::ScheduledActionCommit() { | 1011 void ThreadProxy::ScheduledActionCommit() { |
| 1012 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); | 1012 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
| 1013 DCHECK(IsImplThread()); | 1013 DCHECK(IsImplThread()); |
| 1014 DCHECK(IsMainThreadBlocked()); |
| 1014 DCHECK(commit_completion_event_on_impl_thread_); | 1015 DCHECK(commit_completion_event_on_impl_thread_); |
| 1015 DCHECK(current_resource_update_controller_on_impl_thread_); | 1016 DCHECK(current_resource_update_controller_on_impl_thread_); |
| 1016 | 1017 |
| 1017 // Complete all remaining texture updates. | 1018 // Complete all remaining texture updates. |
| 1018 current_resource_update_controller_on_impl_thread_->Finalize(); | 1019 current_resource_update_controller_on_impl_thread_->Finalize(); |
| 1019 current_resource_update_controller_on_impl_thread_.reset(); | 1020 current_resource_update_controller_on_impl_thread_.reset(); |
| 1020 | 1021 |
| 1021 inside_commit_ = true; | 1022 inside_commit_ = true; |
| 1022 layer_tree_host_impl_->BeginCommit(); | 1023 layer_tree_host_impl_->BeginCommit(); |
| 1023 layer_tree_host()->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 1024 layer_tree_host()->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
| 1024 layer_tree_host()->FinishCommitOnImplThread(layer_tree_host_impl_.get()); | 1025 layer_tree_host()->FinishCommitOnImplThread(layer_tree_host_impl_.get()); |
| 1025 layer_tree_host_impl_->CommitComplete(); | 1026 layer_tree_host_impl_->CommitComplete(); |
| 1026 inside_commit_ = false; | 1027 inside_commit_ = false; |
| 1027 | 1028 |
| 1028 SetInputThrottledUntilCommitOnImplThread(false); | 1029 SetInputThrottledUntilCommitOnImplThread(false); |
| 1029 | 1030 |
| 1030 UpdateBackgroundAnimateTicking(); | 1031 UpdateBackgroundAnimateTicking(); |
| 1031 | 1032 |
| 1032 next_frame_is_newly_committed_frame_on_impl_thread_ = true; | 1033 next_frame_is_newly_committed_frame_on_impl_thread_ = true; |
| 1033 | 1034 |
| 1034 if (layer_tree_host()->settings().impl_side_painting && | 1035 bool hold_commit = layer_tree_host()->settings().impl_side_painting && |
| 1035 commit_waits_for_activation_) { | 1036 commit_waits_for_activation_; |
| 1037 commit_waits_for_activation_ = false; |
| 1038 |
| 1039 if (hold_commit) { |
| 1036 // For some layer types in impl-side painting, the commit is held until | 1040 // For some layer types in impl-side painting, the commit is held until |
| 1037 // the pending tree is activated. It's also possible that the | 1041 // the pending tree is activated. It's also possible that the |
| 1038 // pending tree has already activated if there was no work to be done. | 1042 // pending tree has already activated if there was no work to be done. |
| 1039 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD); | 1043 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD); |
| 1040 completion_event_for_commit_held_on_tree_activation_ = | 1044 completion_event_for_commit_held_on_tree_activation_ = |
| 1041 commit_completion_event_on_impl_thread_; | 1045 commit_completion_event_on_impl_thread_; |
| 1042 commit_completion_event_on_impl_thread_ = NULL; | 1046 commit_completion_event_on_impl_thread_ = NULL; |
| 1043 } else { | 1047 } else { |
| 1044 commit_completion_event_on_impl_thread_->Signal(); | 1048 commit_completion_event_on_impl_thread_->Signal(); |
| 1045 commit_completion_event_on_impl_thread_ = NULL; | 1049 commit_completion_event_on_impl_thread_ = NULL; |
| 1046 } | 1050 } |
| 1047 | 1051 |
| 1048 commit_waits_for_activation_ = false; | |
| 1049 | |
| 1050 commit_complete_time_ = base::TimeTicks::HighResNow(); | 1052 commit_complete_time_ = base::TimeTicks::HighResNow(); |
| 1051 begin_main_frame_to_commit_duration_history_.InsertSample( | 1053 begin_main_frame_to_commit_duration_history_.InsertSample( |
| 1052 commit_complete_time_ - begin_main_frame_sent_time_); | 1054 commit_complete_time_ - begin_main_frame_sent_time_); |
| 1053 | 1055 |
| 1054 // SetVisible kicks off the next scheduler action, so this must be last. | 1056 // SetVisible kicks off the next scheduler action, so this must be last. |
| 1055 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 1057 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 1056 } | 1058 } |
| 1057 | 1059 |
| 1058 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { | 1060 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { |
| 1059 DCHECK(IsImplThread()); | 1061 DCHECK(IsImplThread()); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 commit_to_activate_duration_history_.InsertSample( | 1648 commit_to_activate_duration_history_.InsertSample( |
| 1647 base::TimeTicks::HighResNow() - commit_complete_time_); | 1649 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1648 } | 1650 } |
| 1649 | 1651 |
| 1650 void ThreadProxy::DidManageTiles() { | 1652 void ThreadProxy::DidManageTiles() { |
| 1651 DCHECK(IsImplThread()); | 1653 DCHECK(IsImplThread()); |
| 1652 scheduler_on_impl_thread_->DidManageTiles(); | 1654 scheduler_on_impl_thread_->DidManageTiles(); |
| 1653 } | 1655 } |
| 1654 | 1656 |
| 1655 } // namespace cc | 1657 } // namespace cc |
| OLD | NEW |