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

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

Issue 101573005: Revert of 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 RendererCapabilities::~RendererCapabilities() {} 63 RendererCapabilities::~RendererCapabilities() {}
64 64
65 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( 65 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
66 LayerTreeHostClient* client, 66 LayerTreeHostClient* client,
67 SharedBitmapManager* manager, 67 SharedBitmapManager* manager,
68 const LayerTreeSettings& settings, 68 const LayerTreeSettings& settings,
69 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 69 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
70 DCHECK(impl_task_runner); 70 DCHECK(impl_task_runner);
71 scoped_ptr<LayerTreeHost> layer_tree_host( 71 scoped_ptr<LayerTreeHost> layer_tree_host(
72 new LayerTreeHost(client, manager, settings)); 72 new LayerTreeHost(client, manager, settings));
73 layer_tree_host->InitializeThreaded(impl_task_runner); 73 if (!layer_tree_host->InitializeThreaded(impl_task_runner))
74 return scoped_ptr<LayerTreeHost>();
74 return layer_tree_host.Pass(); 75 return layer_tree_host.Pass();
75 } 76 }
76 77
77 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( 78 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
78 LayerTreeHostClient* client, 79 LayerTreeHostClient* client,
79 LayerTreeHostSingleThreadClient* single_thread_client, 80 LayerTreeHostSingleThreadClient* single_thread_client,
80 SharedBitmapManager* manager, 81 SharedBitmapManager* manager,
81 const LayerTreeSettings& settings) { 82 const LayerTreeSettings& settings) {
82 scoped_ptr<LayerTreeHost> layer_tree_host( 83 scoped_ptr<LayerTreeHost> layer_tree_host(
83 new LayerTreeHost(client, manager, settings)); 84 new LayerTreeHost(client, manager, settings));
84 layer_tree_host->InitializeSingleThreaded(single_thread_client); 85 if (!layer_tree_host->InitializeSingleThreaded(single_thread_client))
86 return scoped_ptr<LayerTreeHost>();
85 return layer_tree_host.Pass(); 87 return layer_tree_host.Pass();
86 } 88 }
87 89
88 90
89 LayerTreeHost::LayerTreeHost( 91 LayerTreeHost::LayerTreeHost(
90 LayerTreeHostClient* client, 92 LayerTreeHostClient* client,
91 SharedBitmapManager* manager, 93 SharedBitmapManager* manager,
92 const LayerTreeSettings& settings) 94 const LayerTreeSettings& settings)
93 : micro_benchmark_controller_(this), 95 : micro_benchmark_controller_(this),
94 next_ui_resource_id_(1), 96 next_ui_resource_id_(1),
(...skipping 22 matching lines...) Expand all
117 total_frames_used_for_lcd_text_metrics_(0), 119 total_frames_used_for_lcd_text_metrics_(0),
118 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 120 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
119 next_commit_forces_redraw_(false), 121 next_commit_forces_redraw_(false),
120 shared_bitmap_manager_(manager) { 122 shared_bitmap_manager_(manager) {
121 if (settings_.accelerated_animation_enabled) 123 if (settings_.accelerated_animation_enabled)
122 animation_registrar_ = AnimationRegistrar::Create(); 124 animation_registrar_ = AnimationRegistrar::Create();
123 rendering_stats_instrumentation_->set_record_rendering_stats( 125 rendering_stats_instrumentation_->set_record_rendering_stats(
124 debug_state_.RecordRenderingStats()); 126 debug_state_.RecordRenderingStats());
125 } 127 }
126 128
127 void LayerTreeHost::InitializeThreaded( 129 bool LayerTreeHost::InitializeThreaded(
128 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 130 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
129 InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); 131 return InitializeProxy(ThreadProxy::Create(this, impl_task_runner));
130 } 132 }
131 133
132 void LayerTreeHost::InitializeSingleThreaded( 134 bool LayerTreeHost::InitializeSingleThreaded(
133 LayerTreeHostSingleThreadClient* single_thread_client) { 135 LayerTreeHostSingleThreadClient* single_thread_client) {
134 InitializeProxy(SingleThreadProxy::Create(this, single_thread_client)); 136 return InitializeProxy(
137 SingleThreadProxy::Create(this, single_thread_client));
135 } 138 }
136 139
137 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { 140 bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
138 InitializeProxy(proxy_for_testing.Pass()); 141 return InitializeProxy(proxy_for_testing.Pass());
139 } 142 }
140 143
141 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { 144 bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
142 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); 145 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal");
143 146
147 scoped_ptr<OutputSurface> output_surface(CreateOutputSurface());
148 if (!output_surface)
149 return false;
150
144 proxy_ = proxy.Pass(); 151 proxy_ = proxy.Pass();
145 proxy_->Start(); 152 proxy_->Start(output_surface.Pass());
153 return true;
146 } 154 }
147 155
148 LayerTreeHost::~LayerTreeHost() { 156 LayerTreeHost::~LayerTreeHost() {
149 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); 157 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost");
150 158
151 overhang_ui_resource_.reset(); 159 overhang_ui_resource_.reset();
152 160
153 if (root_layer_.get()) 161 if (root_layer_.get())
154 root_layer_->SetLayerTreeHost(NULL); 162 root_layer_->SetLayerTreeHost(NULL);
155 163
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 swap_promise_list_.push_back(swap_promise.Pass()); 1265 swap_promise_list_.push_back(swap_promise.Pass());
1258 } 1266 }
1259 1267
1260 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1268 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1261 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1269 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1262 swap_promise_list_[i]->DidNotSwap(reason); 1270 swap_promise_list_[i]->DidNotSwap(reason);
1263 swap_promise_list_.clear(); 1271 swap_promise_list_.clear();
1264 } 1272 }
1265 1273
1266 } // namespace cc 1274 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698