Commit e2394a66 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Add comments for RenderWidget and RenderViewImpl.

This CL clarifies the nature of undead RenderWidgets.

Bug: 419087
Change-Id: Ib6c352b6ce81b1c4ee133c9658b03108d6e48977
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847945
Commit-Queue: Erik Chen <erikchen@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703945}
parent ea7a48ca
...@@ -572,11 +572,10 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, ...@@ -572,11 +572,10 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
// done yet. // done yet.
std::unique_ptr<RenderWidget> render_widget_; std::unique_ptr<RenderWidget> render_widget_;
// This is purely used as storage for a |render_widget_| instance when the // Instances of RenderViewImpl with a proxy main frame do not need a
// main frame has moved out of process. It is a transitional construct // RenderWidget. Unfortunately, we can't delete the object because the browser
// to help figure out many things access |render_widget_| while the main // side RenderWidgetHost/RenderViewHost lifetimes are still entangled. We
// frame remote. Almost no code should ever follow this pointer. // store the RenderWidget in this member, but it should not be used.
//
// TODO(crbug.com/419087): Remove this once RenderWidgets are owned by the // TODO(crbug.com/419087): Remove this once RenderWidgets are owned by the
// main frame. // main frame.
std::unique_ptr<RenderWidget> undead_render_widget_; std::unique_ptr<RenderWidget> undead_render_widget_;
......
...@@ -134,17 +134,28 @@ struct VisualProperties; ...@@ -134,17 +134,28 @@ struct VisualProperties;
// - Widgets for frames (the main frame, and subframes due to out-of-process // - Widgets for frames (the main frame, and subframes due to out-of-process
// iframe support) // iframe support)
// //
// Because the main frame RenderWidget is used to implement RenderViewImpl // Background info:
// (deprecated) it has a shared lifetime. But the RenderViewImpl may have // OOPIF causes webpages to be renderered by multiple renderers. Each renderer
// a proxy main frame which does not use a RenderWidget. Thus a RenderWidget // has one instance of a RenderViewImpl, which represents page state shared by
// can be undead, during the time in which we wish we could delete it but we // each renderer. The frame tree is mirrored across each renderer. Local nodes
// can't, and it should be (relatively.. it's a work in progress) unused during // are represented by RenderFrame, and remote nodes are represented by
// that time. Once a provisional frame exists however, until it is swapped in, // RenderFrameProxy. Each local root has a corresponding RenderWidget. This
// RenderWidget remains undead as it should not exist from the point of view of // RenderWidget is used to route input and graphical output between the browser
// the frame tree or the RenderView, but it does get used then by the // and the renderer.
// provisional frame while still being undead. This concept does not apply to //
// RenderWidgets of subframes, whose lifetimes are not tied to the // For legacy reasons, each RenderViewImpl also has a RenderWidget. The
// RenderViewImpl. // RenderViewImpl hosting the local main frame legitimately needs a
// RenderWidget, since this is a local root. To reduce complexity, we'd like the
// RenderFrame to own the RenderWidget, which it already does for local root
// subframes. This is tracked by https://crbug.com/419087.
//
// RenderViewImpls with a proxy main frame still own a RenderWidget, even though
// the RenderWidget is not used by content/renderer or blink. This is because
// the browser side semantics for RenderWidgetHost, RenderViewHost and
// RenderFrameHost are still entangled. If we destroyed the RenderWidget
// without destroying the corresponding RenderWidgetHost, we'd break IPC
// channels that would not be re-established when recreating the RenderWidget.
// These RenderWidgets are called "undead", and they should never be used.
class CONTENT_EXPORT RenderWidget class CONTENT_EXPORT RenderWidget
: public IPC::Listener, : public IPC::Listener,
public IPC::Sender, public IPC::Sender,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment