Collapse WillCloseLayerTreeView into WebWidget::Close()

These 2 methods are called back-to-back from RenderWidget, which will
in the main-frame case forward directly to the WebView. So we can just
use one method to do this.

WillCloseLayerTreeView is an artifact from when we wanted to move out
of compositing mode if there were no compositing triggers in the page
content, which is no longer the case.

[email protected]

Bug: 927694
Change-Id: Ia3191cecb462400457afd58c5da6f89f07ac9ff4
Reviewed-on: https://chromium-review.googlesource.com/c/1452709
Commit-Queue: danakj <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: enne <[email protected]>
Cr-Commit-Position: refs/heads/master@{#628959}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 234f5d0..01ef8d5 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1839,20 +1839,12 @@
   // closing. Then we would not have to destroy this so carefully.
   screen_metrics_emulator_.reset();
 
-  // Informs the WebWidget that compositor is being destroyed, so it can remove
-  // references to it first.
-  //
   // When delegate() is present, the RenderWidget is for a main frame,
-  // and the GetWebWidget() is not the same as |webwidget_internal_|. However
-  // that widget is responsible for doing WillCloseLayerTreeView() on the
-  // |webwidget_internal_|, not us. Otherwise, they are the same and this is
-  // notifying |webwidget_internal_|.
-  GetWebWidget()->WillCloseLayerTreeView();
-
-  // While the wrapping WebWidget from an delegate() is responsible for
-  // doing WillCloseLayerTreeView() on the |webwidget_internal_|, this class is
-  // responsible for calling Close() on it. Notably, then, the wrapping
-  // WebWidget does not.
+  // and the GetWebWidget() will be a WebFrameWidget, which is not the same as
+  // |webwidget_internal_|. The WebFrameWidget will be closed when the main
+  // frame is detached, so we do not close it here. But it does not close the
+  // |webwidget_internal_| since this class takes responsibility for that here
+  // in all cases.
   webwidget_internal_->Close();
   webwidget_internal_ = nullptr;
 }