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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 new ProxyMain(layer_tree_host, task_runner_provider)); | 41 new ProxyMain(layer_tree_host, task_runner_provider)); |
42 proxy_main->SetChannel(RemoteChannelMain::Create( | 42 proxy_main->SetChannel(RemoteChannelMain::Create( |
43 remote_proto_channel, proxy_main.get(), task_runner_provider)); | 43 remote_proto_channel, proxy_main.get(), task_runner_provider)); |
44 return proxy_main; | 44 return proxy_main; |
45 } | 45 } |
46 | 46 |
47 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, | 47 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, |
48 TaskRunnerProvider* task_runner_provider) | 48 TaskRunnerProvider* task_runner_provider) |
49 : layer_tree_host_(layer_tree_host), | 49 : layer_tree_host_(layer_tree_host), |
50 task_runner_provider_(task_runner_provider), | 50 task_runner_provider_(task_runner_provider), |
51 layer_tree_host_id_(layer_tree_host->id()), | 51 layer_tree_host_id_(layer_tree_host->GetId()), |
52 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), | 52 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), |
53 current_pipeline_stage_(NO_PIPELINE_STAGE), | 53 current_pipeline_stage_(NO_PIPELINE_STAGE), |
54 final_pipeline_stage_(NO_PIPELINE_STAGE), | 54 final_pipeline_stage_(NO_PIPELINE_STAGE), |
55 commit_waits_for_activation_(false), | 55 commit_waits_for_activation_(false), |
56 started_(false), | 56 started_(false), |
57 defer_commits_(false) { | 57 defer_commits_(false) { |
58 TRACE_EVENT0("cc", "ProxyMain::ProxyMain"); | 58 TRACE_EVENT0("cc", "ProxyMain::ProxyMain"); |
59 DCHECK(task_runner_provider_); | 59 DCHECK(task_runner_provider_); |
60 DCHECK(IsMainThread()); | 60 DCHECK(IsMainThread()); |
61 } | 61 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 // If the commit finishes, LayerTreeHost will transfer its swap promises to | 145 // If the commit finishes, LayerTreeHost will transfer its swap promises to |
146 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the | 146 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the |
147 // remaining swap promises. | 147 // remaining swap promises. |
148 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); | 148 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); |
149 | 149 |
150 final_pipeline_stage_ = max_requested_pipeline_stage_; | 150 final_pipeline_stage_ = max_requested_pipeline_stage_; |
151 max_requested_pipeline_stage_ = NO_PIPELINE_STAGE; | 151 max_requested_pipeline_stage_ = NO_PIPELINE_STAGE; |
152 | 152 |
153 if (!layer_tree_host_->visible()) { | 153 if (!layer_tree_host_->IsVisible()) { |
154 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); | 154 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); |
155 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; | 155 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; |
156 channel_main_->BeginMainFrameAbortedOnImpl( | 156 channel_main_->BeginMainFrameAbortedOnImpl( |
157 CommitEarlyOutReason::ABORTED_NOT_VISIBLE, begin_main_frame_start_time, | 157 CommitEarlyOutReason::ABORTED_NOT_VISIBLE, begin_main_frame_start_time, |
158 std::move(empty_swap_promises)); | 158 std::move(empty_swap_promises)); |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 current_pipeline_stage_ = ANIMATE_PIPELINE_STAGE; | 162 current_pipeline_stage_ = ANIMATE_PIPELINE_STAGE; |
163 | 163 |
(...skipping 22 matching lines...) Expand all Loading... |
186 bool can_cancel_this_commit = final_pipeline_stage_ < COMMIT_PIPELINE_STAGE && | 186 bool can_cancel_this_commit = final_pipeline_stage_ < COMMIT_PIPELINE_STAGE && |
187 !begin_main_frame_state->evicted_ui_resources; | 187 !begin_main_frame_state->evicted_ui_resources; |
188 | 188 |
189 current_pipeline_stage_ = UPDATE_LAYERS_PIPELINE_STAGE; | 189 current_pipeline_stage_ = UPDATE_LAYERS_PIPELINE_STAGE; |
190 bool should_update_layers = | 190 bool should_update_layers = |
191 final_pipeline_stage_ >= UPDATE_LAYERS_PIPELINE_STAGE; | 191 final_pipeline_stage_ >= UPDATE_LAYERS_PIPELINE_STAGE; |
192 bool updated = should_update_layers && layer_tree_host_->UpdateLayers(); | 192 bool updated = should_update_layers && layer_tree_host_->UpdateLayers(); |
193 | 193 |
194 layer_tree_host_->WillCommit(); | 194 layer_tree_host_->WillCommit(); |
195 devtools_instrumentation::ScopedCommitTrace commit_task( | 195 devtools_instrumentation::ScopedCommitTrace commit_task( |
196 layer_tree_host_->id()); | 196 layer_tree_host_->GetId()); |
197 | 197 |
198 current_pipeline_stage_ = COMMIT_PIPELINE_STAGE; | 198 current_pipeline_stage_ = COMMIT_PIPELINE_STAGE; |
199 if (!updated && can_cancel_this_commit) { | 199 if (!updated && can_cancel_this_commit) { |
200 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); | 200 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); |
201 channel_main_->BeginMainFrameAbortedOnImpl( | 201 channel_main_->BeginMainFrameAbortedOnImpl( |
202 CommitEarlyOutReason::FINISHED_NO_UPDATES, begin_main_frame_start_time, | 202 CommitEarlyOutReason::FINISHED_NO_UPDATES, begin_main_frame_start_time, |
203 layer_tree_host_->TakeSwapPromises()); | 203 layer_tree_host_->TakeSwapPromises()); |
204 | 204 |
205 // Although the commit is internally aborted, this is because it has been | 205 // Although the commit is internally aborted, this is because it has been |
206 // detected to be a no-op. From the perspective of an embedder, this commit | 206 // detected to be a no-op. From the perspective of an embedder, this commit |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void ProxyMain::MainThreadHasStoppedFlinging() { | 344 void ProxyMain::MainThreadHasStoppedFlinging() { |
345 DCHECK(IsMainThread()); | 345 DCHECK(IsMainThread()); |
346 channel_main_->MainThreadHasStoppedFlingingOnImpl(); | 346 channel_main_->MainThreadHasStoppedFlingingOnImpl(); |
347 } | 347 } |
348 | 348 |
349 void ProxyMain::Start( | 349 void ProxyMain::Start( |
350 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | 350 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { |
351 DCHECK(IsMainThread()); | 351 DCHECK(IsMainThread()); |
352 DCHECK(layer_tree_host_->IsThreaded() || layer_tree_host_->IsRemoteServer()); | 352 DCHECK(layer_tree_host_->IsThreaded() || layer_tree_host_->IsRemoteServer()); |
353 DCHECK(channel_main_); | 353 DCHECK(channel_main_); |
354 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source || | 354 DCHECK(!layer_tree_host_->GetSettings().use_external_begin_frame_source || |
355 external_begin_frame_source); | 355 external_begin_frame_source); |
356 | 356 |
357 // Create LayerTreeHostImpl. | 357 // Create LayerTreeHostImpl. |
358 channel_main_->SynchronouslyInitializeImpl( | 358 channel_main_->SynchronouslyInitializeImpl( |
359 layer_tree_host_, std::move(external_begin_frame_source)); | 359 layer_tree_host_, std::move(external_begin_frame_source)); |
360 | 360 |
361 started_ = true; | 361 started_ = true; |
362 } | 362 } |
363 | 363 |
364 void ProxyMain::Stop() { | 364 void ProxyMain::Stop() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 return false; | 420 return false; |
421 channel_main_->SetNeedsCommitOnImpl(); | 421 channel_main_->SetNeedsCommitOnImpl(); |
422 return true; | 422 return true; |
423 } | 423 } |
424 | 424 |
425 bool ProxyMain::IsMainThread() const { | 425 bool ProxyMain::IsMainThread() const { |
426 return task_runner_provider_->IsMainThread(); | 426 return task_runner_provider_->IsMainThread(); |
427 } | 427 } |
428 | 428 |
429 } // namespace cc | 429 } // namespace cc |
OLD | NEW |