Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Issue 2496233003: Destroy the old RenderWidgetHostView when swapping out a main frame. (Closed)

Created:
4 years, 1 month ago by lfg
Modified:
3 years, 8 months ago
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org, site-isolation-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Destroy the old RenderWidgetHostView when swapping out a main frame. This fixes an issue where the old RenderView is reused by a new remote subframe. We shouldn't be leaking resources, because now we are already hiding the unused RenderView in the renderer, when the local main frame gets detached and the WebViewFrameWidget is closed. BUG=638375 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/9431efdc7b0146ef74f75ce160f2ba343ca2d550 Cr-Commit-Position: refs/heads/master@{#438516}

Patch Set 1 #

Total comments: 23

Patch Set 2 : use is_active instead of is_swapped_out, move code to RFHM #

Patch Set 3 : remove is_swapped_out() #

Patch Set 4 : fix unittest #

Patch Set 5 : add comment #

Patch Set 6 : fix mac test #

Patch Set 7 : rebase #

Total comments: 5

Patch Set 8 : rebase #

Patch Set 9 : fix unit tests, remove dcheck #

Total comments: 4

Patch Set 10 : rebase #

Total comments: 6

Patch Set 11 : rebase #

Patch Set 12 : add alexmos' test, move code to test_renderer_host #

Patch Set 13 : rebase #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+187 lines, -92 lines) Patch
M content/browser/frame_host/render_frame_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +0 lines, -9 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +52 lines, -37 lines 0 comments Download
M content/browser/site_per_process_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +75 lines, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +9 lines, -6 lines 1 comment Download
M content/public/test/test_renderer_host.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -5 lines 0 comments Download
M content/public/test/test_renderer_host.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +43 lines, -35 lines 0 comments Download

Messages

Total messages: 100 (69 generated)
lfg
Charlie, can you take a look? https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc#newcode1513 content/browser/frame_host/render_frame_host_impl.cc:1513: if (frame_tree_node_->IsMainFrame()) { ...
4 years, 1 month ago (2016-11-15 04:37:34 UTC) #7
Charlie Reis
[+alexmos, site-isolation-reviews] Thanks for looking closer at this! After figuring out where these pieces came ...
4 years, 1 month ago (2016-11-15 19:59:05 UTC) #8
alexmos
Some more thoughts below. Sorry, I didn't end up on the reviewer list, so didn't ...
4 years, 1 month ago (2016-11-17 17:55:57 UTC) #10
lfg
Charlie/Alex, please take another look. https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc#newcode1513 content/browser/frame_host/render_frame_host_impl.cc:1513: if (frame_tree_node_->IsMainFrame()) { I ...
4 years, 1 month ago (2016-11-23 00:27:05 UTC) #25
Charlie Reis
Thanks-- the additional simplification seems nice. LGTM, with a few requests for explanations below. https://codereview.chromium.org/2496233003/diff/160001/chrome/browser/search/search_unittest.cc ...
4 years, 1 month ago (2016-11-23 07:25:22 UTC) #28
alexmos
LGTM https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (right): https://codereview.chromium.org/2496233003/diff/1/content/browser/frame_host/render_frame_host_impl.cc#newcode1513 content/browser/frame_host/render_frame_host_impl.cc:1513: if (frame_tree_node_->IsMainFrame()) { On 2016/11/23 00:27:04, lfg wrote: ...
4 years ago (2016-11-23 17:54:45 UTC) #29
lfg
Charlie, can you do one more pass in the changes from the last PS? https://codereview.chromium.org/2496233003/diff/160001/chrome/browser/search/search_unittest.cc ...
4 years ago (2016-11-29 17:41:23 UTC) #40
Charlie Reis
Hmm, I glossed over the test code a bit before, but I'm a bit concerned ...
4 years ago (2016-11-29 19:35:55 UTC) #42
alexmos
https://codereview.chromium.org/2496233003/diff/240001/content/browser/frame_host/render_frame_host_manager.cc File content/browser/frame_host/render_frame_host_manager.cc (right): https://codereview.chromium.org/2496233003/diff/240001/content/browser/frame_host/render_frame_host_manager.cc#newcode725 content/browser/frame_host/render_frame_host_manager.cc:725: rvh->set_is_active(false); On 2016/11/29 19:35:55, Charlie Reis (slow) wrote: > ...
4 years ago (2016-11-29 19:47:38 UTC) #43
lfg
On 2016/11/29 19:47:38, alexmos wrote: > I'm a bit confused by this actually. We start ...
4 years ago (2016-11-30 23:46:43 UTC) #44
lfg
On 2016/11/29 19:35:55, Charlie Reis (slow) wrote: > Hmm, I glossed over the test code ...
4 years ago (2016-11-30 23:50:04 UTC) #45
lfg
On 2016/11/30 23:50:04, lfg wrote: > On 2016/11/29 19:35:55, Charlie Reis (slow) wrote: > > ...
4 years ago (2016-12-01 19:45:44 UTC) #52
Charlie Reis
Thanks-- I'm feeling better about it, though I still have questions about the search_unittest.cc one. ...
4 years ago (2016-12-01 23:57:26 UTC) #59
alexmos
On 2016/11/30 23:46:43, lfg wrote: > On 2016/11/29 19:47:38, alexmos wrote: > > I'm a ...
4 years ago (2016-12-02 01:50:49 UTC) #60
lfg
Please, take another look. I've included Alex's test that tests that we correctly have the ...
4 years ago (2016-12-06 22:47:04 UTC) #64
Charlie Reis
Thanks for the test framework cleanup and extra test! LGTM, if Alex is happy with ...
4 years ago (2016-12-08 18:26:04 UTC) #67
alexmos
LGTM, thanks!
4 years ago (2016-12-09 19:35:20 UTC) #68
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2496233003/360001
4 years ago (2016-12-10 04:42:28 UTC) #70
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/196527)
4 years ago (2016-12-10 06:23:05 UTC) #72
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2496233003/360001
4 years ago (2016-12-10 06:38:16 UTC) #74
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/196552)
4 years ago (2016-12-10 08:11:02 UTC) #76
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2496233003/360001
4 years ago (2016-12-12 21:23:39 UTC) #78
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/354670)
4 years ago (2016-12-13 02:06:38 UTC) #80
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2496233003/360001
4 years ago (2016-12-13 20:05:44 UTC) #82
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/325071)
4 years ago (2016-12-13 20:14:40 UTC) #84
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2496233003/380001
4 years ago (2016-12-14 14:41:51 UTC) #91
commit-bot: I haz the power
Committed patchset #13 (id:380001)
4 years ago (2016-12-14 14:46:04 UTC) #94
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/9431efdc7b0146ef74f75ce160f2ba343ca2d550 Cr-Commit-Position: refs/heads/master@{#438516}
4 years ago (2016-12-14 14:48:20 UTC) #96
piman
https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_contents/web_contents_impl.cc File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_contents/web_contents_impl.cc#newcode4927 content/browser/web_contents/web_contents_impl.cc:4927: // reused, the RWHV is created in RenderFrameHostManager::CommitPending. Belated ...
3 years, 8 months ago (2017-03-28 20:57:56 UTC) #98
dcheng
On 2017/03/28 20:57:56, piman wrote: > https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_contents/web_contents_impl.cc > File content/browser/web_contents/web_contents_impl.cc (right): > > https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_contents/web_contents_impl.cc#newcode4927 > ...
3 years, 8 months ago (2017-03-28 21:04:25 UTC) #99
piman
3 years, 8 months ago (2017-03-28 21:25:17 UTC) #100
Message was sent while issue was closed.
On 2017/03/28 21:04:25, dcheng wrote:
> On 2017/03/28 20:57:56, piman wrote:
> >
>
https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_co...
> > File content/browser/web_contents/web_contents_impl.cc (right):
> > 
> >
>
https://codereview.chromium.org/2496233003/diff/380001/content/browser/web_co...
> > content/browser/web_contents/web_contents_impl.cc:4927: // reused, the RWHV
is
> > created in RenderFrameHostManager::CommitPending.
> > Belated drive-by...
> > 
> > This seems to be assuming it's ok to destroy and then recreate a RWHV on the
> > same RWHI. I don't think it's true at all - some state is distributed
between
> > RW, RWHI and RWHV and so RWHI must be 1:1 with RWHV, at least without a fair
> > amount of refactoring. Among others, the RWHV is holding on to and manages
> > graphics resources sent by the RW, and it leads to a lot of confusion (and
> > possibly leaks) if the RW ends up talking to different RWHV without knowing
> > anything about it.
> > 
> > 
> > Why are RVH "reused"? Could we not destroy the RWHV if they are?
> 
> RVH is reused because the RV in the renderer persists as well. It's
non-trivial
> to recreate the RV: RV holds blink::WebView which holds the blink::Page, etc.

How did it work before? RV and RW have been the same thing forever, why is it
suddenly an issue?

> However, it looks like reusing the RVH/RV is quite problematic as well...
while
> the long-term answer here is to split the compositing bits out of RenderView
> completely, can we get away with a hack in the short-term? e.g. some sort of
> "reset compositor" method on RV to bring it back to a clean-enough slate that
> things won't explode?

I'm not sure. There's more than just the compositor, there are a bunch of things
such as sizing, input events, IME, accessibility, focus, mouse capture, cursor,
etc. where the RWHV is what keeps the state, not the RWHI. Can we recreate all
that state? Maybe? Sounds like a lot of work! Should we? I'm not sure...

Powered by Google App Engine
This is Rietveld 408576698