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 DCHECK(!new_output_surface_); | 391 proxy_->SetOutputSurface(surface.Pass()); |
392 new_output_surface_ = surface.Pass(); | |
393 proxy_->SetOutputSurface(new_output_surface_.get()); | |
394 } | 392 } |
395 | 393 |
396 void LayerTreeHost::RequestNewOutputSurface() { | 394 void LayerTreeHost::RequestNewOutputSurface() { |
397 client_->RequestNewOutputSurface(); | 395 client_->RequestNewOutputSurface(); |
398 } | 396 } |
399 | 397 |
400 void LayerTreeHost::DidInitializeOutputSurface() { | 398 void LayerTreeHost::DidInitializeOutputSurface() { |
401 DCHECK(new_output_surface_); | |
402 output_surface_lost_ = false; | 399 output_surface_lost_ = false; |
403 current_output_surface_ = new_output_surface_.Pass(); | |
404 client_->DidInitializeOutputSurface(); | 400 client_->DidInitializeOutputSurface(); |
405 } | 401 } |
406 | 402 |
407 void LayerTreeHost::DidFailToInitializeOutputSurface() { | 403 void LayerTreeHost::DidFailToInitializeOutputSurface() { |
408 DCHECK(output_surface_lost_); | 404 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; | |
415 client_->DidFailToInitializeOutputSurface(); | 405 client_->DidFailToInitializeOutputSurface(); |
416 } | 406 } |
417 | 407 |
418 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 408 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
419 LayerTreeHostImplClient* client) { | 409 LayerTreeHostImplClient* client) { |
420 DCHECK(proxy_->IsImplThread()); | 410 DCHECK(proxy_->IsImplThread()); |
421 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 411 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
422 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), | 412 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), |
423 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, | 413 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, |
424 id_); | 414 id_); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1236 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1247 : false; | 1237 : false; |
1248 } | 1238 } |
1249 | 1239 |
1250 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1240 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1251 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1241 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1252 : false; | 1242 : false; |
1253 } | 1243 } |
1254 | 1244 |
1255 } // namespace cc | 1245 } // namespace cc |
OLD | NEW |