| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 client_->DidCompletePageScaleAnimation(); | 378 client_->DidCompletePageScaleAnimation(); |
| 379 did_complete_scale_animation_ = false; | 379 did_complete_scale_animation_ = false; |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { | 383 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { |
| 384 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 384 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); |
| 385 DCHECK(output_surface_lost_); | 385 DCHECK(output_surface_lost_); |
| 386 DCHECK(surface); | 386 DCHECK(surface); |
| 387 | 387 |
| 388 proxy_->SetOutputSurface(surface.Pass()); | 388 DCHECK(!new_output_surface_); |
| 389 new_output_surface_ = surface.Pass(); |
| 390 proxy_->SetOutputSurface(new_output_surface_.get()); |
| 389 } | 391 } |
| 390 | 392 |
| 391 scoped_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { | 393 scoped_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { |
| 392 DCHECK(!visible_); | 394 DCHECK(!visible_); |
| 393 DCHECK(!output_surface_lost_); | 395 DCHECK(!output_surface_lost_); |
| 394 | 396 |
| 395 DidLoseOutputSurface(); | 397 DidLoseOutputSurface(); |
| 396 return proxy_->ReleaseOutputSurface(); | 398 proxy_->ReleaseOutputSurface(); |
| 399 return current_output_surface_.Pass(); |
| 397 } | 400 } |
| 398 | 401 |
| 399 void LayerTreeHost::RequestNewOutputSurface() { | 402 void LayerTreeHost::RequestNewOutputSurface() { |
| 400 client_->RequestNewOutputSurface(); | 403 client_->RequestNewOutputSurface(); |
| 401 } | 404 } |
| 402 | 405 |
| 403 void LayerTreeHost::DidInitializeOutputSurface() { | 406 void LayerTreeHost::DidInitializeOutputSurface() { |
| 407 DCHECK(new_output_surface_); |
| 404 output_surface_lost_ = false; | 408 output_surface_lost_ = false; |
| 409 current_output_surface_ = new_output_surface_.Pass(); |
| 405 client_->DidInitializeOutputSurface(); | 410 client_->DidInitializeOutputSurface(); |
| 406 } | 411 } |
| 407 | 412 |
| 408 void LayerTreeHost::DidFailToInitializeOutputSurface() { | 413 void LayerTreeHost::DidFailToInitializeOutputSurface() { |
| 409 DCHECK(output_surface_lost_); | 414 DCHECK(output_surface_lost_); |
| 415 DCHECK(new_output_surface_); |
| 416 // Note: It is safe to drop all output surface references here as |
| 417 // LayerTreeHostImpl will not keep a pointer to either the old or |
| 418 // new output surface after failing to initialize the new one. |
| 419 current_output_surface_ = nullptr; |
| 420 new_output_surface_ = nullptr; |
| 410 client_->DidFailToInitializeOutputSurface(); | 421 client_->DidFailToInitializeOutputSurface(); |
| 411 } | 422 } |
| 412 | 423 |
| 413 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 424 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
| 414 LayerTreeHostImplClient* client) { | 425 LayerTreeHostImplClient* client) { |
| 415 DCHECK(proxy_->IsImplThread()); | 426 DCHECK(proxy_->IsImplThread()); |
| 416 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 427 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
| 417 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), | 428 settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(), |
| 418 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, | 429 shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, |
| 419 id_); | 430 id_); |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1228 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
| 1218 : false; | 1229 : false; |
| 1219 } | 1230 } |
| 1220 | 1231 |
| 1221 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1232 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
| 1222 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1233 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
| 1223 : false; | 1234 : false; |
| 1224 } | 1235 } |
| 1225 | 1236 |
| 1226 } // namespace cc | 1237 } // namespace cc |
| OLD | NEW |