| Index: chrome/browser/android/vr_shell/vr_compositor.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_compositor.cc b/chrome/browser/android/vr_shell/vr_compositor.cc
|
| index 882236f53d8c54bc360732be0577f7ce87a000b4..e386d90180d14204e4ac1e80b8b90ff615f0fb42 100644
|
| --- a/chrome/browser/android/vr_shell/vr_compositor.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_compositor.cc
|
| @@ -20,12 +20,8 @@ VrCompositor::VrCompositor(ui::WindowAndroid* window, bool transparent)
|
| }
|
|
|
| VrCompositor::~VrCompositor() {
|
| - if (layer_) {
|
| - layer_->SetBackgroundColor(background_color_);
|
| - if (layer_parent_) {
|
| - layer_parent_->AddChild(layer_);
|
| - }
|
| - }
|
| + if (layer_)
|
| + RestoreLayer();
|
| }
|
|
|
| void VrCompositor::UpdateLayerTreeHost() {}
|
| @@ -33,7 +29,8 @@ void VrCompositor::UpdateLayerTreeHost() {}
|
| void VrCompositor::OnSwapBuffersCompleted(int pending_swap_buffers) {}
|
|
|
| void VrCompositor::SetLayer(content::WebContents* web_contents) {
|
| - assert(layer_ == nullptr);
|
| + if (layer_)
|
| + RestoreLayer();
|
| ui::ViewAndroid* view_android = web_contents->GetNativeView();
|
|
|
| // When we pass the layer for the ContentViewCore to the compositor it may be
|
| @@ -50,6 +47,13 @@ void VrCompositor::SetLayer(content::WebContents* web_contents) {
|
| compositor_->SetRootLayer(layer_);
|
| }
|
|
|
| +void VrCompositor::RestoreLayer() {
|
| + layer_->SetBackgroundColor(background_color_);
|
| + if (layer_parent_) {
|
| + layer_parent_->AddChild(layer_);
|
| + }
|
| +}
|
| +
|
| void VrCompositor::SurfaceDestroyed() {
|
| compositor_->SetSurface(nullptr);
|
| }
|
|
|