| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 hud_layer_->RemoveFromParent(); | 406 hud_layer_->RemoveFromParent(); |
| 407 hud_layer_ = NULL; | 407 hud_layer_ = NULL; |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 void LayerTreeHost::CommitComplete() { | 411 void LayerTreeHost::CommitComplete() { |
| 412 source_frame_number_++; | 412 source_frame_number_++; |
| 413 client_->DidCommit(); | 413 client_->DidCommit(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { | 416 scoped_ptr<OutputSurface> LayerTreeHost::CreateOutputSurface() { |
| 417 proxy_->SetOutputSurface(surface.Pass()); | 417 return client_->CreateOutputSurface(num_failed_recreate_attempts_ >= 4); |
| 418 } | |
| 419 | |
| 420 void LayerTreeHost::RequestNewOutputSurface() { | |
| 421 client_->RequestNewOutputSurface(num_failed_recreate_attempts_ >= 4); | |
| 422 } | 418 } |
| 423 | 419 |
| 424 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 420 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
| 425 LayerTreeHostImplClient* client) { | 421 LayerTreeHostImplClient* client) { |
| 426 DCHECK(proxy_->IsImplThread()); | 422 DCHECK(proxy_->IsImplThread()); |
| 427 scoped_ptr<LayerTreeHostImpl> host_impl = | 423 scoped_ptr<LayerTreeHostImpl> host_impl = |
| 428 LayerTreeHostImpl::Create(settings_, | 424 LayerTreeHostImpl::Create(settings_, |
| 429 client, | 425 client, |
| 430 proxy_.get(), | 426 proxy_.get(), |
| 431 rendering_stats_instrumentation_.get(), | 427 rendering_stats_instrumentation_.get(), |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 proxy_->NotifyInputThrottledUntilCommit(); | 711 proxy_->NotifyInputThrottledUntilCommit(); |
| 716 } | 712 } |
| 717 | 713 |
| 718 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { | 714 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { |
| 719 DCHECK(!proxy_->HasImplThread()); | 715 DCHECK(!proxy_->HasImplThread()); |
| 720 // This function is only valid when not using the scheduler. | 716 // This function is only valid when not using the scheduler. |
| 721 DCHECK(!settings_.single_thread_proxy_scheduler); | 717 DCHECK(!settings_.single_thread_proxy_scheduler); |
| 722 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); | 718 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); |
| 723 | 719 |
| 724 SetLayerTreeHostClientReady(); | 720 SetLayerTreeHostClientReady(); |
| 725 if (output_surface_lost_) { | 721 |
| 726 RequestNewOutputSurface(); | 722 if (output_surface_lost_) |
| 727 // RequestNewOutputSurface could have synchronously created an output | 723 proxy->CreateAndInitializeOutputSurface(); |
| 728 // surface, so check again before returning. | 724 if (output_surface_lost_) |
| 729 if (output_surface_lost_) | 725 return; |
| 730 return; | |
| 731 } | |
| 732 | 726 |
| 733 proxy->CompositeImmediately(frame_begin_time); | 727 proxy->CompositeImmediately(frame_begin_time); |
| 734 } | 728 } |
| 735 | 729 |
| 736 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) { | 730 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) { |
| 737 DCHECK(!output_surface_lost_); | 731 DCHECK(!output_surface_lost_); |
| 738 | 732 |
| 739 if (!root_layer()) | 733 if (!root_layer()) |
| 740 return false; | 734 return false; |
| 741 | 735 |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 swap_promise_list_.push_back(swap_promise.Pass()); | 1317 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1324 } | 1318 } |
| 1325 | 1319 |
| 1326 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1320 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1327 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1321 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1328 swap_promise_list_[i]->DidNotSwap(reason); | 1322 swap_promise_list_[i]->DidNotSwap(reason); |
| 1329 swap_promise_list_.clear(); | 1323 swap_promise_list_.clear(); |
| 1330 } | 1324 } |
| 1331 | 1325 |
| 1332 } // namespace cc | 1326 } // namespace cc |
| OLD | NEW |