Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index c14736a939ed6f9fb213dbbca516fb4e8b776c0b..e91980543c5a2912e95731e1db7b2849a4fc6b52 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -98,21 +98,36 @@ UIResourceRequest& UIResourceRequest::operator=( |
UIResourceRequest::~UIResourceRequest() {} |
-scoped_ptr<LayerTreeHost> LayerTreeHost::Create( |
+scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( |
LayerTreeHostClient* client, |
SharedBitmapManager* manager, |
const LayerTreeSettings& settings, |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
+ DCHECK(impl_task_runner); |
scoped_ptr<LayerTreeHost> layer_tree_host( |
new LayerTreeHost(client, manager, settings)); |
- if (!layer_tree_host->Initialize(impl_task_runner)) |
+ if (!layer_tree_host->InitializeThreaded(impl_task_runner)) |
return scoped_ptr<LayerTreeHost>(); |
return layer_tree_host.Pass(); |
} |
-LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
- SharedBitmapManager* manager, |
- const LayerTreeSettings& settings) |
+scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( |
+ LayerTreeHostClient* client, |
+ LayerTreeHostSingleThreadClient* single_thread_client, |
+ SharedBitmapManager* manager, |
+ 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>(); |
+ return layer_tree_host.Pass(); |
+} |
+ |
+ |
+LayerTreeHost::LayerTreeHost( |
+ LayerTreeHostClient* client, |
+ SharedBitmapManager* manager, |
+ const LayerTreeSettings& settings) |
: next_ui_resource_id_(1), |
animating_(false), |
needs_full_tree_sync_(true), |
@@ -147,12 +162,15 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
debug_state_.RecordRenderingStats()); |
} |
-bool LayerTreeHost::Initialize( |
+bool LayerTreeHost::InitializeThreaded( |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { |
- if (impl_task_runner.get()) |
- return InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); |
- else |
- return InitializeProxy(SingleThreadProxy::Create(this)); |
+ return InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); |
+} |
+ |
+bool LayerTreeHost::InitializeSingleThreaded( |
+ LayerTreeHostSingleThreadClient* single_thread_client) { |
+ return InitializeProxy( |
+ SingleThreadProxy::Create(this, single_thread_client)); |
} |
bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
@@ -562,8 +580,6 @@ void LayerTreeHost::SetNeedsRedraw() { |
void LayerTreeHost::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
proxy_->SetNeedsRedraw(damage_rect); |
- if (!proxy_->HasImplThread()) |
- client_->ScheduleComposite(); |
} |
bool LayerTreeHost::CommitRequested() const { |
@@ -739,10 +755,6 @@ void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { |
SetNeedsCommit(); |
} |
-void LayerTreeHost::ScheduleComposite() { |
- client_->ScheduleComposite(); |
-} |
- |
bool LayerTreeHost::InitializeOutputSurfaceIfNeeded() { |
if (!output_surface_can_be_initialized_) |
return false; |