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

Side by Side Diff: cc/trees/single_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: add tests 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 26 matching lines...) Expand all
37 inside_draw_(false) { 37 inside_draw_(false) {
38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
39 DCHECK(Proxy::IsMainThread()); 39 DCHECK(Proxy::IsMainThread());
40 DCHECK(layer_tree_host); 40 DCHECK(layer_tree_host);
41 41
42 // Impl-side painting not supported without threaded compositing. 42 // Impl-side painting not supported without threaded compositing.
43 CHECK(!layer_tree_host->settings().impl_side_painting) 43 CHECK(!layer_tree_host->settings().impl_side_painting)
44 << "Threaded compositing must be enabled to use impl-side painting."; 44 << "Threaded compositing must be enabled to use impl-side painting.";
45 } 45 }
46 46
47 void SingleThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { 47 void SingleThreadProxy::Start() {
48 DCHECK(first_output_surface);
49 DebugScopedSetImplThread impl(this); 48 DebugScopedSetImplThread impl(this);
50 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 49 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
51 first_output_surface_ = first_output_surface.Pass();
52 } 50 }
53 51
54 SingleThreadProxy::~SingleThreadProxy() { 52 SingleThreadProxy::~SingleThreadProxy() {
55 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 53 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
56 DCHECK(Proxy::IsMainThread()); 54 DCHECK(Proxy::IsMainThread());
57 // Make sure Stop() got called or never Started. 55 // Make sure Stop() got called or never Started.
58 DCHECK(!layer_tree_host_impl_); 56 DCHECK(!layer_tree_host_impl_);
59 } 57 }
60 58
61 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { 59 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 104
107 // Changing visibility could change ShouldComposite(). 105 // Changing visibility could change ShouldComposite().
108 UpdateBackgroundAnimateTicking(); 106 UpdateBackgroundAnimateTicking();
109 } 107 }
110 108
111 void SingleThreadProxy::CreateAndInitializeOutputSurface() { 109 void SingleThreadProxy::CreateAndInitializeOutputSurface() {
112 TRACE_EVENT0( 110 TRACE_EVENT0(
113 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); 111 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
114 DCHECK(Proxy::IsMainThread()); 112 DCHECK(Proxy::IsMainThread());
115 113
116 scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass(); 114 scoped_ptr<OutputSurface> output_surface =
117 if (!output_surface) 115 layer_tree_host_->CreateOutputSurface();
118 output_surface = layer_tree_host_->CreateOutputSurface();
119 if (!output_surface) { 116 if (!output_surface) {
120 OnOutputSurfaceInitializeAttempted(false); 117 OnOutputSurfaceInitializeAttempted(false);
121 return; 118 return;
122 } 119 }
123 120
124 scoped_refptr<cc::ContextProvider> offscreen_context_provider; 121 scoped_refptr<cc::ContextProvider> offscreen_context_provider;
125 if (created_offscreen_context_provider_) { 122 if (created_offscreen_context_provider_) {
126 offscreen_context_provider = 123 offscreen_context_provider =
127 layer_tree_host_->client()->OffscreenContextProvider(); 124 layer_tree_host_->client()->OffscreenContextProvider();
128 if (!offscreen_context_provider.get() || 125 if (!offscreen_context_provider.get() ||
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 void SingleThreadProxy::DidSwapFrame() { 539 void SingleThreadProxy::DidSwapFrame() {
543 if (next_frame_is_newly_committed_frame_) { 540 if (next_frame_is_newly_committed_frame_) {
544 next_frame_is_newly_committed_frame_ = false; 541 next_frame_is_newly_committed_frame_ = false;
545 layer_tree_host_->DidCommitAndDrawFrame(); 542 layer_tree_host_->DidCommitAndDrawFrame();
546 } 543 }
547 } 544 }
548 545
549 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 546 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
550 547
551 } // namespace cc 548 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698