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/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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 client_->DidCompletePageScaleAnimation(); | 381 client_->DidCompletePageScaleAnimation(); |
382 did_complete_scale_animation_ = false; | 382 did_complete_scale_animation_ = false; |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { | 386 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { |
387 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 387 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); |
388 DCHECK(output_surface_lost_); | 388 DCHECK(output_surface_lost_); |
389 DCHECK(surface); | 389 DCHECK(surface); |
390 | 390 |
391 proxy_->SetOutputSurface(surface.Pass()); | 391 DCHECK(!new_output_surface_); |
392 new_output_surface_ = surface.Pass(); | |
393 proxy_->SetOutputSurface(new_output_surface_.get()); | |
piman
2015/09/14 21:54:38
Would it be possible to add a test that verifies t
reveman
2015/09/15 20:38:35
Done. LayerTreeHostTestDestroyWhileInitializingOut
| |
392 } | 394 } |
393 | 395 |
394 void LayerTreeHost::RequestNewOutputSurface() { | 396 void LayerTreeHost::RequestNewOutputSurface() { |
395 client_->RequestNewOutputSurface(); | 397 client_->RequestNewOutputSurface(); |
396 } | 398 } |
397 | 399 |
398 void LayerTreeHost::DidInitializeOutputSurface() { | 400 void LayerTreeHost::DidInitializeOutputSurface() { |
401 DCHECK(new_output_surface_); | |
399 output_surface_lost_ = false; | 402 output_surface_lost_ = false; |
403 current_output_surface_ = new_output_surface_.Pass(); | |
400 client_->DidInitializeOutputSurface(); | 404 client_->DidInitializeOutputSurface(); |
401 } | 405 } |
402 | 406 |
403 void LayerTreeHost::DidFailToInitializeOutputSurface() { | 407 void LayerTreeHost::DidFailToInitializeOutputSurface() { |
404 DCHECK(output_surface_lost_); | 408 DCHECK(output_surface_lost_); |
409 DCHECK(new_output_surface_); | |
410 // Note: It is safe to drop all output surface references here as | |
411 // LayerTreeHostImpl will not keep a pointer to either the old or | |
412 // new output surface after failing to initialize the new one. | |
413 current_output_surface_ = nullptr; | |
414 new_output_surface_ = nullptr; | |
405 client_->DidFailToInitializeOutputSurface(); | 415 client_->DidFailToInitializeOutputSurface(); |
406 } | 416 } |
407 | 417 |
408 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 418 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
409 LayerTreeHostImplClient* client) { | 419 LayerTreeHostImplClient* client) { |
410 DCHECK(proxy_->IsImplThread()); | 420 DCHECK(proxy_->IsImplThread()); |
411 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 421 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
412 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), | 422 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), |
413 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, | 423 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, |
414 id_); | 424 id_); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1237 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1247 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1238 : false; | 1248 : false; |
1239 } | 1249 } |
1240 | 1250 |
1241 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1251 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1242 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1252 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1243 : false; | 1253 : false; |
1244 } | 1254 } |
1245 | 1255 |
1246 } // namespace cc | 1256 } // namespace cc |
OLD | NEW |