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

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

Issue 85693007: cc: Defer first OutputSurface creation until client is ready (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 impl_thread_weak_ptr_, 194 impl_thread_weak_ptr_,
195 &completion)); 195 &completion));
196 completion.Wait(); 196 completion.Wait();
197 } 197 }
198 198
199 bool ThreadProxy::IsStarted() const { 199 bool ThreadProxy::IsStarted() const {
200 DCHECK(Proxy::IsMainThread()); 200 DCHECK(Proxy::IsMainThread());
201 return started_; 201 return started_;
202 } 202 }
203 203
204 void ThreadProxy::SetLayerTreeHostClientReady() { 204 void ThreadProxy::SetLayerTreeHostClientReady(
205 scoped_ptr<OutputSurface> first_output_surface) {
205 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady"); 206 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady");
207 DCHECK(first_output_surface);
208 first_output_surface_ = first_output_surface.Pass();
209
206 Proxy::ImplThreadTaskRunner()->PostTask( 210 Proxy::ImplThreadTaskRunner()->PostTask(
207 FROM_HERE, 211 FROM_HERE,
208 base::Bind(&ThreadProxy::SetLayerTreeHostClientReadyOnImplThread, 212 base::Bind(&ThreadProxy::SetLayerTreeHostClientReadyOnImplThread,
209 impl_thread_weak_ptr_)); 213 impl_thread_weak_ptr_));
210 } 214 }
211 215
212 void ThreadProxy::SetLayerTreeHostClientReadyOnImplThread() { 216 void ThreadProxy::SetLayerTreeHostClientReadyOnImplThread() {
213 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread"); 217 TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread");
214 scheduler_on_impl_thread_->SetCanStart(); 218 scheduler_on_impl_thread_->SetCanStart();
215 } 219 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 DCHECK(IsMainThread() || IsMainThreadBlocked()); 619 DCHECK(IsMainThread() || IsMainThreadBlocked());
616 return layer_tree_host()->contents_texture_manager(); 620 return layer_tree_host()->contents_texture_manager();
617 } 621 }
618 622
619 PrioritizedResourceManager* 623 PrioritizedResourceManager*
620 ThreadProxy::contents_texture_manager_on_impl_thread() { 624 ThreadProxy::contents_texture_manager_on_impl_thread() {
621 DCHECK(IsImplThread()); 625 DCHECK(IsImplThread());
622 return contents_texture_manager_unsafe_; 626 return contents_texture_manager_unsafe_;
623 } 627 }
624 628
625 void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { 629 void ThreadProxy::Start() {
626 DCHECK(IsMainThread()); 630 DCHECK(IsMainThread());
627 DCHECK(Proxy::HasImplThread()); 631 DCHECK(Proxy::HasImplThread());
628 DCHECK(first_output_surface);
629 632
630 // Create LayerTreeHostImpl. 633 // Create LayerTreeHostImpl.
631 DebugScopedSetMainThreadBlocked main_thread_blocked(this); 634 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
632 CompletionEvent completion; 635 CompletionEvent completion;
633 Proxy::ImplThreadTaskRunner()->PostTask( 636 Proxy::ImplThreadTaskRunner()->PostTask(
634 FROM_HERE, 637 FROM_HERE,
635 base::Bind(&ThreadProxy::InitializeImplOnImplThread, 638 base::Bind(&ThreadProxy::InitializeImplOnImplThread,
636 base::Unretained(this), 639 base::Unretained(this),
637 &completion)); 640 &completion));
638 completion.Wait(); 641 completion.Wait();
639 642
640 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); 643 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr();
641 first_output_surface_ = first_output_surface.Pass();
642 644
643 started_ = true; 645 started_ = true;
644 } 646 }
645 647
646 void ThreadProxy::Stop() { 648 void ThreadProxy::Stop() {
647 TRACE_EVENT0("cc", "ThreadProxy::Stop"); 649 TRACE_EVENT0("cc", "ThreadProxy::Stop");
648 DCHECK(IsMainThread()); 650 DCHECK(IsMainThread());
649 DCHECK(started_); 651 DCHECK(started_);
650 652
651 // Synchronously finishes pending GL operations and deletes the impl. 653 // Synchronously finishes pending GL operations and deletes the impl.
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 commit_to_activate_duration_history_.InsertSample( 1628 commit_to_activate_duration_history_.InsertSample(
1627 base::TimeTicks::HighResNow() - commit_complete_time_); 1629 base::TimeTicks::HighResNow() - commit_complete_time_);
1628 } 1630 }
1629 1631
1630 void ThreadProxy::DidManageTiles() { 1632 void ThreadProxy::DidManageTiles() {
1631 DCHECK(IsImplThread()); 1633 DCHECK(IsImplThread());
1632 scheduler_on_impl_thread_->DidManageTiles(); 1634 scheduler_on_impl_thread_->DidManageTiles();
1633 } 1635 }
1634 1636
1635 } // namespace cc 1637 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698