Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index fa6664a6623ecaaac1e6ceefb598bbc500da7b55..5e2b00b9330d23a818603e1a92d6985cd3e6ce39 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -1020,6 +1020,18 @@ void LayerTreeHostImpl::SetManagedMemoryPolicy( |
client_->SetNeedsCommitOnImplThread(); |
} |
+bool LayerTreeHostImpl::InitializeForGL( |
+ scoped_refptr<ContextProvider> offscreen_context_provider) { |
+ scoped_ptr<OutputSurface> output_surface = CleanupForRendererInitialization(); |
+ bool success = DoInitializeRenderer(output_surface.Pass()); |
+ if (success) { |
+ resource_provider_->set_offscreen_context_provider( |
+ offscreen_context_provider); |
+ client_->DidUpdateCapabilitiesOnImplThread(); |
+ } |
+ return success; |
+} |
+ |
void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
} |
@@ -1379,8 +1391,8 @@ ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const { |
return actual; |
} |
-bool LayerTreeHostImpl::InitializeRenderer( |
- scoped_ptr<OutputSurface> output_surface) { |
+scoped_ptr<OutputSurface> |
+LayerTreeHostImpl::CleanupForRendererInitialization() { |
// Since we will create a new resource provider, we cannot continue to use |
// the old resources (i.e. render_surfaces and texture IDs). Clear them |
// before we destroy the old resource provider. |
@@ -1399,11 +1411,11 @@ bool LayerTreeHostImpl::InitializeRenderer( |
renderer_.reset(); |
tile_manager_.reset(); |
resource_provider_.reset(); |
- output_surface_.reset(); |
- |
- if (!output_surface->BindToClient(this)) |
- return false; |
+ return output_surface_.Pass(); |
+} |
+bool LayerTreeHostImpl::DoInitializeRenderer( |
+ scoped_ptr<OutputSurface> output_surface) { |
scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( |
output_surface.get(), settings_.highp_threshold_min); |
if (!resource_provider) |
@@ -1451,6 +1463,18 @@ bool LayerTreeHostImpl::InitializeRenderer( |
return true; |
} |
+bool LayerTreeHostImpl::InitializeRenderer( |
+ scoped_ptr<OutputSurface> output_surface) { |
+ scoped_ptr<OutputSurface> old_output_surface = |
+ CleanupForRendererInitialization(); |
+ old_output_surface.reset(); |
+ |
+ if (!output_surface->BindToClient(this)) |
+ return false; |
+ |
+ return DoInitializeRenderer(output_surface.Pass()); |
+} |
+ |
void LayerTreeHostImpl::SetViewportSize(gfx::Size device_viewport_size) { |
if (device_viewport_size == device_viewport_size_) |
return; |