OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proxy_main.h" | 5 #include "cc/trees/proxy_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 layer_tree_host_->BeginMainFrame(begin_main_frame_state->begin_frame_args); | 180 layer_tree_host_->BeginMainFrame(begin_main_frame_state->begin_frame_args); |
181 layer_tree_host_->AnimateLayers( | 181 layer_tree_host_->AnimateLayers( |
182 begin_main_frame_state->begin_frame_args.frame_time); | 182 begin_main_frame_state->begin_frame_args.frame_time); |
183 | 183 |
184 // Recreate all UI resources if there were evicted UI resources when the impl | 184 // Recreate all UI resources if there were evicted UI resources when the impl |
185 // thread initiated the commit. | 185 // thread initiated the commit. |
186 if (begin_main_frame_state->evicted_ui_resources) | 186 if (begin_main_frame_state->evicted_ui_resources) |
187 layer_tree_host_->GetUIResourceManager()->RecreateUIResources(); | 187 layer_tree_host_->GetUIResourceManager()->RecreateUIResources(); |
188 | 188 |
189 layer_tree_host_->RequestMainFrameUpdate(); | 189 layer_tree_host_->RequestMainFrameUpdate(); |
| 190 |
| 191 // At this point the main frame may have deferred commits to avoid committing |
| 192 // right now. |
| 193 if (defer_commits_) { |
| 194 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit_InsideBeginMainFrame", |
| 195 TRACE_EVENT_SCOPE_THREAD); |
| 196 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; |
| 197 ImplThreadTaskRunner()->PostTask( |
| 198 FROM_HERE, base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl, |
| 199 base::Unretained(proxy_impl_.get()), |
| 200 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT, |
| 201 begin_main_frame_start_time, |
| 202 base::Passed(&empty_swap_promises))); |
| 203 current_pipeline_stage_ = NO_PIPELINE_STAGE; |
| 204 // We intentionally don't report CommitComplete() here since it was aborted |
| 205 // prematurely and we're waiting to do another commit in the future. |
| 206 layer_tree_host_->DidBeginMainFrame(); |
| 207 return; |
| 208 } |
| 209 |
190 TRACE_EVENT_SYNTHETIC_DELAY_END("cc.BeginMainFrame"); | 210 TRACE_EVENT_SYNTHETIC_DELAY_END("cc.BeginMainFrame"); |
191 | 211 |
192 bool can_cancel_this_commit = final_pipeline_stage_ < COMMIT_PIPELINE_STAGE && | 212 bool can_cancel_this_commit = final_pipeline_stage_ < COMMIT_PIPELINE_STAGE && |
193 !begin_main_frame_state->evicted_ui_resources; | 213 !begin_main_frame_state->evicted_ui_resources; |
194 | 214 |
195 current_pipeline_stage_ = UPDATE_LAYERS_PIPELINE_STAGE; | 215 current_pipeline_stage_ = UPDATE_LAYERS_PIPELINE_STAGE; |
196 bool should_update_layers = | 216 bool should_update_layers = |
197 final_pipeline_stage_ >= UPDATE_LAYERS_PIPELINE_STAGE; | 217 final_pipeline_stage_ >= UPDATE_LAYERS_PIPELINE_STAGE; |
198 bool updated = should_update_layers && layer_tree_host_->UpdateLayers(); | 218 bool updated = should_update_layers && layer_tree_host_->UpdateLayers(); |
199 | 219 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 505 |
486 bool ProxyMain::IsImplThread() const { | 506 bool ProxyMain::IsImplThread() const { |
487 return task_runner_provider_->IsImplThread(); | 507 return task_runner_provider_->IsImplThread(); |
488 } | 508 } |
489 | 509 |
490 base::SingleThreadTaskRunner* ProxyMain::ImplThreadTaskRunner() { | 510 base::SingleThreadTaskRunner* ProxyMain::ImplThreadTaskRunner() { |
491 return task_runner_provider_->ImplThreadTaskRunner(); | 511 return task_runner_provider_->ImplThreadTaskRunner(); |
492 } | 512 } |
493 | 513 |
494 } // namespace cc | 514 } // namespace cc |
OLD | NEW |