Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: cc/trees/proxy_main.cc

Issue 2188093002: cc: Complete swap promise for aborted commit after pending activation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: post rebase fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/proxy_impl.cc ('k') | cc/trees/remote_channel_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now(); 139 base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now();
140 140
141 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); 141 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
142 DCHECK(IsMainThread()); 142 DCHECK(IsMainThread());
143 DCHECK_EQ(NO_PIPELINE_STAGE, current_pipeline_stage_); 143 DCHECK_EQ(NO_PIPELINE_STAGE, current_pipeline_stage_);
144 144
145 if (defer_commits_) { 145 if (defer_commits_) {
146 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", 146 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
147 TRACE_EVENT_SCOPE_THREAD); 147 TRACE_EVENT_SCOPE_THREAD);
148 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises;
148 channel_main_->BeginMainFrameAbortedOnImpl( 149 channel_main_->BeginMainFrameAbortedOnImpl(
149 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT, 150 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT,
150 begin_main_frame_start_time); 151 begin_main_frame_start_time, std::move(empty_swap_promises));
151 return; 152 return;
152 } 153 }
153 154
154 // If the commit finishes, LayerTreeHost will transfer its swap promises to 155 // If the commit finishes, LayerTreeHost will transfer its swap promises to
155 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the 156 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the
156 // remaining swap promises. 157 // remaining swap promises.
157 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); 158 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_);
158 159
159 final_pipeline_stage_ = max_requested_pipeline_stage_; 160 final_pipeline_stage_ = max_requested_pipeline_stage_;
160 max_requested_pipeline_stage_ = NO_PIPELINE_STAGE; 161 max_requested_pipeline_stage_ = NO_PIPELINE_STAGE;
161 162
162 if (!layer_tree_host_->visible()) { 163 if (!layer_tree_host_->visible()) {
163 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); 164 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
165 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises;
164 channel_main_->BeginMainFrameAbortedOnImpl( 166 channel_main_->BeginMainFrameAbortedOnImpl(
165 CommitEarlyOutReason::ABORTED_NOT_VISIBLE, begin_main_frame_start_time); 167 CommitEarlyOutReason::ABORTED_NOT_VISIBLE, begin_main_frame_start_time,
168 std::move(empty_swap_promises));
166 return; 169 return;
167 } 170 }
168 171
169 if (layer_tree_host_->output_surface_lost()) { 172 if (layer_tree_host_->output_surface_lost()) {
170 TRACE_EVENT_INSTANT0("cc", "EarlyOut_OutputSurfaceLost", 173 TRACE_EVENT_INSTANT0("cc", "EarlyOut_OutputSurfaceLost",
171 TRACE_EVENT_SCOPE_THREAD); 174 TRACE_EVENT_SCOPE_THREAD);
175 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises;
172 channel_main_->BeginMainFrameAbortedOnImpl( 176 channel_main_->BeginMainFrameAbortedOnImpl(
173 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST, 177 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST,
174 begin_main_frame_start_time); 178 begin_main_frame_start_time, std::move(empty_swap_promises));
175 return; 179 return;
176 } 180 }
177 181
178 current_pipeline_stage_ = ANIMATE_PIPELINE_STAGE; 182 current_pipeline_stage_ = ANIMATE_PIPELINE_STAGE;
179 183
180 layer_tree_host_->ApplyScrollAndScale( 184 layer_tree_host_->ApplyScrollAndScale(
181 begin_main_frame_state->scroll_info.get()); 185 begin_main_frame_state->scroll_info.get());
182 186
183 if (begin_main_frame_state->begin_frame_callbacks) { 187 if (begin_main_frame_state->begin_frame_callbacks) {
184 for (auto& callback : *begin_main_frame_state->begin_frame_callbacks) 188 for (auto& callback : *begin_main_frame_state->begin_frame_callbacks)
(...skipping 23 matching lines...) Expand all
208 bool updated = should_update_layers && layer_tree_host_->UpdateLayers(); 212 bool updated = should_update_layers && layer_tree_host_->UpdateLayers();
209 213
210 layer_tree_host_->WillCommit(); 214 layer_tree_host_->WillCommit();
211 devtools_instrumentation::ScopedCommitTrace commit_task( 215 devtools_instrumentation::ScopedCommitTrace commit_task(
212 layer_tree_host_->id()); 216 layer_tree_host_->id());
213 217
214 current_pipeline_stage_ = COMMIT_PIPELINE_STAGE; 218 current_pipeline_stage_ = COMMIT_PIPELINE_STAGE;
215 if (!updated && can_cancel_this_commit) { 219 if (!updated && can_cancel_this_commit) {
216 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); 220 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD);
217 channel_main_->BeginMainFrameAbortedOnImpl( 221 channel_main_->BeginMainFrameAbortedOnImpl(
218 CommitEarlyOutReason::FINISHED_NO_UPDATES, begin_main_frame_start_time); 222 CommitEarlyOutReason::FINISHED_NO_UPDATES, begin_main_frame_start_time,
223 layer_tree_host_->TakeSwapPromises());
219 224
220 // Although the commit is internally aborted, this is because it has been 225 // Although the commit is internally aborted, this is because it has been
221 // detected to be a no-op. From the perspective of an embedder, this commit 226 // detected to be a no-op. From the perspective of an embedder, this commit
222 // went through, and input should no longer be throttled, etc. 227 // went through, and input should no longer be throttled, etc.
223 current_pipeline_stage_ = NO_PIPELINE_STAGE; 228 current_pipeline_stage_ = NO_PIPELINE_STAGE;
224 layer_tree_host_->CommitComplete(); 229 layer_tree_host_->CommitComplete();
225 layer_tree_host_->DidBeginMainFrame(); 230 layer_tree_host_->DidBeginMainFrame();
226 layer_tree_host_->BreakSwapPromises(SwapPromise::COMMIT_NO_UPDATE);
227 return; 231 return;
228 } 232 }
229 233
230 // Notify the impl thread that the main thread is ready to commit. This will 234 // Notify the impl thread that the main thread is ready to commit. This will
231 // begin the commit process, which is blocking from the main thread's 235 // begin the commit process, which is blocking from the main thread's
232 // point of view, but asynchronously performed on the impl thread, 236 // point of view, but asynchronously performed on the impl thread,
233 // coordinated by the Scheduler. 237 // coordinated by the Scheduler.
234 { 238 {
235 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrame::commit"); 239 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrame::commit");
236 240
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 return false; 459 return false;
456 channel_main_->SetNeedsCommitOnImpl(); 460 channel_main_->SetNeedsCommitOnImpl();
457 return true; 461 return true;
458 } 462 }
459 463
460 bool ProxyMain::IsMainThread() const { 464 bool ProxyMain::IsMainThread() const {
461 return task_runner_provider_->IsMainThread(); 465 return task_runner_provider_->IsMainThread();
462 } 466 }
463 467
464 } // namespace cc 468 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/proxy_impl.cc ('k') | cc/trees/remote_channel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698