Index: content/browser/renderer_host/compositor_impl_android.cc |
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc |
index 838ec057b606a6595040bd8f44d24232116bc885..52e12c5ffa4cd796c12954391d459a238aeab032 100644 |
--- a/content/browser/renderer_host/compositor_impl_android.cc |
+++ b/content/browser/renderer_host/compositor_impl_android.cc |
@@ -365,8 +365,7 @@ CompositorImpl::SharedVulkanContextProviderAndroid() { |
CompositorImpl::CompositorImpl(CompositorClient* client, |
gfx::NativeWindow root_window) |
- : root_layer_(cc::Layer::Create()), |
- surface_id_allocator_(CreateSurfaceIdAllocator()), |
+ : surface_id_allocator_(CreateSurfaceIdAllocator()), |
resource_manager_(root_window), |
has_transparent_background_(false), |
device_scale_factor_(1), |
@@ -382,6 +381,7 @@ CompositorImpl::CompositorImpl(CompositorClient* client, |
weak_factory_(this) { |
DCHECK(client); |
DCHECK(root_window); |
+ root_window->SetLayer(cc::Layer::Create()); |
root_window->AttachCompositor(this); |
CreateLayerTreeHost(); |
resource_manager_.Init(host_.get()); |
@@ -389,6 +389,7 @@ CompositorImpl::CompositorImpl(CompositorClient* client, |
CompositorImpl::~CompositorImpl() { |
root_window_->DetachCompositor(); |
+ root_window_->SetLayer(nullptr); |
// Clean-up any surface references. |
SetSurface(NULL); |
} |
@@ -406,9 +407,9 @@ void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
subroot_layer_->RemoveFromParent(); |
subroot_layer_ = NULL; |
} |
- if (root_layer.get()) { |
- subroot_layer_ = root_layer; |
- root_layer_->AddChild(root_layer); |
+ if (root_window_->GetLayer()) { |
+ subroot_layer_ = root_window_->GetLayer(); |
+ root_window_->GetLayer()->AddChild(root_layer); |
} |
} |
@@ -474,7 +475,7 @@ void CompositorImpl::CreateLayerTreeHost() { |
params.animation_host = cc::AnimationHost::CreateMainInstance(); |
host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
DCHECK(!host_->visible()); |
- host_->SetRootLayer(root_layer_); |
+ host_->SetRootLayer(root_window_->GetLayer()); |
host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); |
host_->SetViewportSize(size_); |
host_->set_has_transparent_background(has_transparent_background_); |
@@ -516,7 +517,7 @@ void CompositorImpl::SetWindowBounds(const gfx::Size& size) { |
host_->SetViewportSize(size); |
if (display_) |
display_->Resize(size); |
- root_layer_->SetBounds(size); |
+ root_window_->GetLayer()->SetBounds(size); |
} |
void CompositorImpl::SetHasTransparentBackground(bool flag) { |
@@ -780,7 +781,7 @@ void CompositorImpl::DidCommit() { |
void CompositorImpl::RequestCopyOfOutputOnRootLayer( |
std::unique_ptr<cc::CopyOutputRequest> request) { |
- root_layer_->RequestCopyOfOutput(std::move(request)); |
+ root_window_->GetLayer()->RequestCopyOfOutput(std::move(request)); |
} |
void CompositorImpl::OnVSync(base::TimeTicks frame_time, |