Make RenderFrameHostImpl::GetRenderWidgetHost() always return an object
Using GetRenderWidgetHost as an accessor for the RFHI's data member is
error prone because it is easy to assume that a frame attached to the
frame tree will always have a widget to talk to, and also it is
inconsistent with RenderViewImpl::GetHost() which does not return
nullptr.
While it is generally preferable for features to interact with a
RenderWidgetHostView rather than a RenderWidgetHost for the purposes
of input and renderering interactions, where possible, RenderWidgetHost
availability is sometimes necessary and GetView() can unavoidably
return nullptr in some cases (for instance, if the renderer just
crashed).
This CL also does some related cleanup.
BUG=455245
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review-Url: https://codereview.chromium.org/2023453003
Cr-Commit-Position: refs/heads/master@{#396751}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 8bf93085..e67fc30 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2365,7 +2365,7 @@
void WebContentsImpl::SendScreenRects() {
for (FrameTreeNode* node : frame_tree_.Nodes()) {
- if (node->current_frame_host()->GetRenderWidgetHost())
+ if (node->current_frame_host()->is_local_root())
node->current_frame_host()->GetRenderWidgetHost()->SendScreenRects();
}