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

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

Issue 348093004: Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android compile fixes Created 6 years, 2 months 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 | Annotate | Revision Log
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 scoped_ptr<OutputSurface> LayerTreeHost::CreateOutputSurface() { 416 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) {
417 return client_->CreateOutputSurface(num_failed_recreate_attempts_ >= 4); 417 proxy_->SetOutputSurface(surface.Pass());
418 }
419
420 void LayerTreeHost::RequestNewOutputSurface() {
421 client_->RequestNewOutputSurface(num_failed_recreate_attempts_ >= 4);
418 } 422 }
419 423
420 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 424 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
421 LayerTreeHostImplClient* client) { 425 LayerTreeHostImplClient* client) {
422 DCHECK(proxy_->IsImplThread()); 426 DCHECK(proxy_->IsImplThread());
423 scoped_ptr<LayerTreeHostImpl> host_impl = 427 scoped_ptr<LayerTreeHostImpl> host_impl =
424 LayerTreeHostImpl::Create(settings_, 428 LayerTreeHostImpl::Create(settings_,
425 client, 429 client,
426 proxy_.get(), 430 proxy_.get(),
427 rendering_stats_instrumentation_.get(), 431 rendering_stats_instrumentation_.get(),
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 proxy_->NotifyInputThrottledUntilCommit(); 715 proxy_->NotifyInputThrottledUntilCommit();
712 } 716 }
713 717
714 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { 718 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) {
715 DCHECK(!proxy_->HasImplThread()); 719 DCHECK(!proxy_->HasImplThread());
716 // This function is only valid when not using the scheduler. 720 // This function is only valid when not using the scheduler.
717 DCHECK(!settings_.single_thread_proxy_scheduler); 721 DCHECK(!settings_.single_thread_proxy_scheduler);
718 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); 722 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
719 723
720 SetLayerTreeHostClientReady(); 724 SetLayerTreeHostClientReady();
721 725 if (output_surface_lost_) {
722 if (output_surface_lost_) 726 RequestNewOutputSurface();
723 proxy->CreateAndInitializeOutputSurface(); 727 // RequestNewOutputSurface could have synchronously created an output
724 if (output_surface_lost_) 728 // surface, so check again before returning.
725 return; 729 if (output_surface_lost_)
730 return;
731 }
726 732
727 proxy->CompositeImmediately(frame_begin_time); 733 proxy->CompositeImmediately(frame_begin_time);
728 } 734 }
729 735
730 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) { 736 bool LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue) {
731 DCHECK(!output_surface_lost_); 737 DCHECK(!output_surface_lost_);
732 738
733 if (!root_layer()) 739 if (!root_layer())
734 return false; 740 return false;
735 741
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 swap_promise_list_.push_back(swap_promise.Pass()); 1323 swap_promise_list_.push_back(swap_promise.Pass());
1318 } 1324 }
1319 1325
1320 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1326 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1321 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1327 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1322 swap_promise_list_[i]->DidNotSwap(reason); 1328 swap_promise_list_[i]->DidNotSwap(reason);
1323 swap_promise_list_.clear(); 1329 swap_promise_list_.clear();
1324 } 1330 }
1325 1331
1326 } // namespace cc 1332 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698