Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index 5addf281a877f04084a501140ce88b927e10f951..c1e1d4bef5d2b4e181b441ccece32f8d19cc3180 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -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)); |
-} |
- |
-void LayerTreeHost::InitializeSingleThreaded( |
+ return InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); |
+} |
+ |
+bool LayerTreeHost::InitializeSingleThreaded( |
LayerTreeHostSingleThreadClient* single_thread_client) { |
- InitializeProxy(SingleThreadProxy::Create(this, single_thread_client)); |
-} |
- |
-void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
- InitializeProxy(proxy_for_testing.Pass()); |
-} |
- |
-void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
+ return InitializeProxy( |
+ SingleThreadProxy::Create(this, single_thread_client)); |
+} |
+ |
+bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
+ return InitializeProxy(proxy_for_testing.Pass()); |
+} |
+ |
+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() { |