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

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

Issue 666163006: Allow layers to signal that additional sequences are needed before surface destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 content_is_suitable_for_gpu_rasterization_(true), 120 content_is_suitable_for_gpu_rasterization_(true),
121 gpu_rasterization_histogram_recorded_(false), 121 gpu_rasterization_histogram_recorded_(false),
122 background_color_(SK_ColorWHITE), 122 background_color_(SK_ColorWHITE),
123 has_transparent_background_(false), 123 has_transparent_background_(false),
124 partial_texture_update_requests_(0), 124 partial_texture_update_requests_(0),
125 in_paint_layer_contents_(false), 125 in_paint_layer_contents_(false),
126 total_frames_used_for_lcd_text_metrics_(0), 126 total_frames_used_for_lcd_text_metrics_(0),
127 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 127 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
128 next_commit_forces_redraw_(false), 128 next_commit_forces_redraw_(false),
129 shared_bitmap_manager_(shared_bitmap_manager), 129 shared_bitmap_manager_(shared_bitmap_manager),
130 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { 130 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
131 surface_id_namespace_(0),
132 next_surface_sequence_(1) {
jamesr 2014/10/29 00:51:10 these two are uints, so 0u / 1u
131 if (settings_.accelerated_animation_enabled) 133 if (settings_.accelerated_animation_enabled)
132 animation_registrar_ = AnimationRegistrar::Create(); 134 animation_registrar_ = AnimationRegistrar::Create();
133 rendering_stats_instrumentation_->set_record_rendering_stats( 135 rendering_stats_instrumentation_->set_record_rendering_stats(
134 debug_state_.RecordRenderingStats()); 136 debug_state_.RecordRenderingStats());
135 } 137 }
136 138
137 void LayerTreeHost::InitializeThreaded( 139 void LayerTreeHost::InitializeThreaded(
138 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 140 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
139 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 141 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
140 InitializeProxy( 142 InitializeProxy(
(...skipping 18 matching lines...) Expand all
159 proxy_->Start(); 161 proxy_->Start();
160 if (settings_.accelerated_animation_enabled) { 162 if (settings_.accelerated_animation_enabled) {
161 animation_registrar_->set_supports_scroll_animations( 163 animation_registrar_->set_supports_scroll_animations(
162 proxy_->SupportsImplScrolling()); 164 proxy_->SupportsImplScrolling());
163 } 165 }
164 } 166 }
165 167
166 LayerTreeHost::~LayerTreeHost() { 168 LayerTreeHost::~LayerTreeHost() {
167 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); 169 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost");
168 170
169 DCHECK(swap_promise_monitor_.empty());
170
171 BreakSwapPromises(SwapPromise::COMMIT_FAILS);
172
173 overhang_ui_resource_ = nullptr; 171 overhang_ui_resource_ = nullptr;
174 172
175 if (root_layer_.get()) 173 if (root_layer_.get())
176 root_layer_->SetLayerTreeHost(NULL); 174 root_layer_->SetLayerTreeHost(NULL);
177 175
176 DCHECK(swap_promise_monitor_.empty());
177
178 BreakSwapPromises(SwapPromise::COMMIT_FAILS);
179
178 if (proxy_) { 180 if (proxy_) {
179 DCHECK(proxy_->IsMainThread()); 181 DCHECK(proxy_->IsMainThread());
180 proxy_->Stop(); 182 proxy_->Stop();
181 } 183 }
182 184
183 // We must clear any pointers into the layer tree prior to destroying it. 185 // We must clear any pointers into the layer tree prior to destroying it.
184 RegisterViewportLayers(NULL, NULL, NULL); 186 RegisterViewportLayers(NULL, NULL, NULL);
185 187
186 if (root_layer_.get()) { 188 if (root_layer_.get()) {
187 // The layer tree must be destroyed before the layer tree host. We've 189 // The layer tree must be destroyed before the layer tree host. We've
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 DCHECK(swap_promise); 1333 DCHECK(swap_promise);
1332 swap_promise_list_.push_back(swap_promise.Pass()); 1334 swap_promise_list_.push_back(swap_promise.Pass());
1333 } 1335 }
1334 1336
1335 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1337 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1336 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1338 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1337 swap_promise_list_[i]->DidNotSwap(reason); 1339 swap_promise_list_[i]->DidNotSwap(reason);
1338 swap_promise_list_.clear(); 1340 swap_promise_list_.clear();
1339 } 1341 }
1340 1342
1343 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) {
1344 surface_id_namespace_ = id_namespace;
1345 }
1346
1347 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() {
1348 return SurfaceSequence(surface_id_namespace_, ++next_surface_sequence_);
1349 }
1350
1341 } // namespace cc 1351 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698