Index: trunk/src/cc/trees/layer_tree_host.cc |
=================================================================== |
--- trunk/src/cc/trees/layer_tree_host.cc (revision 238469) |
+++ trunk/src/cc/trees/layer_tree_host.cc (working copy) |
@@ -70,7 +70,8 @@ |
DCHECK(impl_task_runner); |
scoped_ptr<LayerTreeHost> layer_tree_host( |
new LayerTreeHost(client, manager, settings)); |
- layer_tree_host->InitializeThreaded(impl_task_runner); |
+ if (!layer_tree_host->InitializeThreaded(impl_task_runner)) |
+ return scoped_ptr<LayerTreeHost>(); |
return layer_tree_host.Pass(); |
} |
@@ -81,7 +82,8 @@ |
const LayerTreeSettings& settings) { |
scoped_ptr<LayerTreeHost> layer_tree_host( |
new LayerTreeHost(client, manager, settings)); |
- layer_tree_host->InitializeSingleThreaded(single_thread_client); |
+ if (!layer_tree_host->InitializeSingleThreaded(single_thread_client)) |
+ return scoped_ptr<LayerTreeHost>(); |
return layer_tree_host.Pass(); |
} |
@@ -124,25 +126,31 @@ |
debug_state_.RecordRenderingStats()); |
} |
-void LayerTreeHost::InitializeThreaded( |
+bool LayerTreeHost::InitializeThreaded( |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
- InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); |
+ return InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); |
} |
-void LayerTreeHost::InitializeSingleThreaded( |
+bool LayerTreeHost::InitializeSingleThreaded( |
LayerTreeHostSingleThreadClient* single_thread_client) { |
- InitializeProxy(SingleThreadProxy::Create(this, single_thread_client)); |
+ return InitializeProxy( |
+ SingleThreadProxy::Create(this, single_thread_client)); |
} |
-void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
- InitializeProxy(proxy_for_testing.Pass()); |
+bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
+ return InitializeProxy(proxy_for_testing.Pass()); |
} |
-void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
+bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
+ scoped_ptr<OutputSurface> output_surface(CreateOutputSurface()); |
+ if (!output_surface) |
+ return false; |
+ |
proxy_ = proxy.Pass(); |
- proxy_->Start(); |
+ proxy_->Start(output_surface.Pass()); |
+ return true; |
} |
LayerTreeHost::~LayerTreeHost() { |