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

Unified Diff: cc/trees/layer_tree_host.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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index df82093bd91fe977a23dbef3f69241721ea482fe..0bf15ad1d0d96a6294453d8de66ea4457ad1add5 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -78,8 +78,7 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
DCHECK(impl_task_runner);
scoped_ptr<LayerTreeHost> layer_tree_host(
new LayerTreeHost(client, manager, settings));
- if (!layer_tree_host->InitializeThreaded(impl_task_runner))
- return scoped_ptr<LayerTreeHost>();
+ layer_tree_host->InitializeThreaded(impl_task_runner);
return layer_tree_host.Pass();
}
@@ -90,8 +89,7 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
const LayerTreeSettings& settings) {
scoped_ptr<LayerTreeHost> layer_tree_host(
new LayerTreeHost(client, manager, settings));
- if (!layer_tree_host->InitializeSingleThreaded(single_thread_client))
- return scoped_ptr<LayerTreeHost>();
+ layer_tree_host->InitializeSingleThreaded(single_thread_client);
return layer_tree_host.Pass();
}
@@ -108,6 +106,7 @@ LayerTreeHost::LayerTreeHost(
client_(client),
source_frame_number_(0),
rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
+ client_ready_(false),
output_surface_can_be_initialized_(true),
output_surface_lost_(true),
num_failed_recreate_attempts_(0),
@@ -134,31 +133,25 @@ LayerTreeHost::LayerTreeHost(
debug_state_.RecordRenderingStats());
}
-bool LayerTreeHost::InitializeThreaded(
+void LayerTreeHost::InitializeThreaded(
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
- return InitializeProxy(ThreadProxy::Create(this, impl_task_runner));
+ InitializeProxy(ThreadProxy::Create(this, impl_task_runner));
}
-bool LayerTreeHost::InitializeSingleThreaded(
+void LayerTreeHost::InitializeSingleThreaded(
LayerTreeHostSingleThreadClient* single_thread_client) {
- return InitializeProxy(
- SingleThreadProxy::Create(this, single_thread_client));
+ InitializeProxy(SingleThreadProxy::Create(this, single_thread_client));
}
-bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
- return InitializeProxy(proxy_for_testing.Pass());
+void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
+ InitializeProxy(proxy_for_testing.Pass());
}
-bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
+void 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(output_surface.Pass());
- return true;
+ proxy_->Start();
}
LayerTreeHost::~LayerTreeHost() {
@@ -182,8 +175,11 @@ LayerTreeHost::~LayerTreeHost() {
}
}
-void LayerTreeHost::SetLayerTreeHostClientReady() {
- proxy_->SetLayerTreeHostClientReady();
+void LayerTreeHost::SetLayerTreeHostClientReady(
+ scoped_ptr<OutputSurface> first_output_surface) {
+ DCHECK(!client_ready_);
+ client_ready_ = true;
+ proxy_->SetLayerTreeHostClientReady(first_output_surface.Pass());
}
static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) {

Powered by Google App Engine
This is Rietveld 408576698