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

Issue 1308113008: OOPIFs: Transitioning Get/Send...SavableResourceLinks away from RenderViewHost. (Closed)

Created:
5 years, 3 months ago by Łukasz Anforowicz
Modified:
5 years, 3 months ago
CC:
chromium-reviews, asanka, mlamouri+watch-content_chromium.org, creis+watch_chromium.org, benjhayden+dwatch_chromium.org, nasko+codewatch_chromium.org, jam, darin-cc_chromium.org, mkwst+moarreviews-renderer_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@page-serialization-test
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

OOPIFs: Transitioning Get/Send...SavableResourceLinks away from RenderViewHost. RenderView => RenderFrame ========================= This CL replaces ViewMsg_GetAllSavableResourceLinksForCurrentPage and ViewHostMsg_SendCurrentPageAllSavableResourceLinks IPC messages by their frame-oriented equivalents: FrameMsg_GetSavableResourceLinks, FrameHostMsg_SavableResourceLinksResponse and FrameHostMsg_NonSavableResponse (last one is needed to distinguish between 1) a non-savable frame and 2) a savable frame with no savable resources underneath it). URL uniqueness and referrers ============================ SavePackage creates only one SaveItem per unique URL to be saved. This CL moves uniqueness checks that used to be done in content/renderer/savable_resources.cc into content/browser/download/save_package.cc Having only one SaveItem per given URL means that the code has to pick a single referrer out of multiple referrals made from the page to the given URL. This is true both for the old and new code. There might be a need to follow-up to make sure that this is a valid approach (i.e. some servers might return different content for different referrers, but the same URL). I've opened crbug.com/528453 to track this. Just as before, after this CL we also take care to first process savable resource links (preferring their referrers) and only later process frame urls. OTOH, after this CL we do not prefer referrers appearing earlier (when sychronously walking over all subframes), but instead prefer referrers from renderer processes which reply first (which can be somewhat random). Racyness of URL / content changes ================================= Page content can change (i.e. with changes trigerred by javascript) between the time the user requests save-page-as and the time we ask renderers for savable links and serialized content. The old code tries to protect against this, by 1. Calling Stop() in WebContentsImpl::OnSavePage 2. Verifying in content/renderer/savable_resources.cc that |page_url| (top-level url of the page user wants to save) is the same as |main_page_gurl| (current top-level url of the page). In case of (2), save-page-as is cancelled. Note that the old behavior of cancelling save-page-as in case of content changes means that saving frequently changing content (i.e. page that self-refreshes every X seconds) will fail every now and then. It seems preferrable to continue save-page-as in this case (as it will give the user files with some (maybe more recent than intended) content rather than fail altogether (i.e. this is preferrable because this behavior can satisfy users who are ok with more recent content, whereas the other behavior would fail to satisfy any users). Also note that (2) does not protect against changes in subframes - in this case the new subframe url will not appear in "urls that have local copy" field of ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks message (and therefore the saved html will not be truly "complete"). Because of the above, the current CL doesn't make any attempt to try to enumerate and lock down URLs of frames in the "before" state and ensure that the same URLs are processed during later stages of save-page-as (gathering savable resource links [this CL] and serialization [later CLs]). BUG=526786 Committed: https://crrev.com/6af746b740287560dbc9e85d22738000bc72b521 Cr-Commit-Position: refs/heads/master@{#349809}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Fixed 2 minor issues caught during a late self-review. #

Total comments: 39

Patch Set 3 : Addressed most of CR feedback from Nasko. #

Total comments: 15

Patch Set 4 : Addressed more CR feedback from Nasko. #

Total comments: 2

Patch Set 5 : Addressed remaining CR feedback from Nasko. #

Patch Set 6 : Preserving old behavior wrt referrers. #

Patch Set 7 : Fixing member initialization in the other constructor. #

Patch Set 8 : Make Send target the right renderer process. #

Total comments: 2

Patch Set 9 : Calling Send directly on RenderFrameHost. #

Total comments: 12

Patch Set 10 : Addressed CR feedback from Randy. #

Total comments: 2

Patch Set 11 : Removed braces from some short if statements. #

Patch Set 12 : Rebasing... #

Patch Set 13 : Fixed savable_resources_browsertest.cc to use RenderFrame rather than RenderView. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -234 lines) Patch
M chrome/browser/download/save_page_browsertest.cc View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/download/save_package.h View 1 2 3 4 5 4 chunks +23 lines, -7 lines 0 comments Download
M content/browser/download/save_package.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +86 lines, -34 lines 0 comments Download
M content/common/frame_messages.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +15 lines, -0 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -10 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +27 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -1 line 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -42 lines 0 comments Download
M content/renderer/savable_resources.h View 2 chunks +9 lines, -14 lines 0 comments Download
M content/renderer/savable_resources.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +11 lines, -97 lines 0 comments Download
M content/renderer/savable_resources_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +17 lines, -28 lines 0 comments Download

Messages

Total messages: 37 (8 generated)
Łukasz Anforowicz
Nasko, can you please take a look? https://codereview.chromium.org/1308113008/diff/1/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/1/content/browser/download/save_package.cc#newcode1201 content/browser/download/save_package.cc:1201: continue; In ...
5 years, 3 months ago (2015-09-02 18:03:34 UTC) #2
nasko
Thanks for the quick CL and help! I think we also need someone that knows ...
5 years, 3 months ago (2015-09-02 23:45:56 UTC) #3
Łukasz Anforowicz
Nasko - can you please take another look? I tried to address most of your ...
5 years, 3 months ago (2015-09-03 16:59:57 UTC) #4
nasko
https://codereview.chromium.org/1308113008/diff/20001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/20001/content/browser/download/save_package.cc#newcode345 content/browser/download/save_package.cc:345: DCHECK_EQ(SAVE_PAGE_TYPE_AS_ONLY_HTML, save_type_) << save_type_; On 2015/09/03 16:59:57, Łukasz Anforowicz ...
5 years, 3 months ago (2015-09-03 18:17:02 UTC) #5
Łukasz Anforowicz
Nasko, can you take one more look please? https://codereview.chromium.org/1308113008/diff/20001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/20001/content/browser/download/save_package.cc#newcode1161 content/browser/download/save_package.cc:1161: WebContents* ...
5 years, 3 months ago (2015-09-03 19:41:25 UTC) #6
nasko
https://codereview.chromium.org/1308113008/diff/40001/content/browser/download/save_package.h File content/browser/download/save_package.h (right): https://codereview.chromium.org/1308113008/diff/40001/content/browser/download/save_package.h#newcode150 content/browser/download/save_package.h:150: bool OnMessageReceived(const IPC::Message&, RenderFrameHost* source) override; On 2015/09/03 19:41:24, ...
5 years, 3 months ago (2015-09-04 16:03:21 UTC) #7
Łukasz Anforowicz
Nasko, could you please take another look? There are 2 sets of unreviewed changes here: ...
5 years, 3 months ago (2015-09-08 16:23:21 UTC) #8
nasko
I think this is good! Let's loop in asanka@ and I'll stamp the review once ...
5 years, 3 months ago (2015-09-09 00:51:21 UTC) #9
Łukasz Anforowicz
Asanka, could you please take a look? In addition to looking at the code, could ...
5 years, 3 months ago (2015-09-09 16:59:25 UTC) #11
Łukasz Anforowicz
Adding Randy as a reviewer and moving Asanka to CC (as discussed over email earlier ...
5 years, 3 months ago (2015-09-14 17:31:42 UTC) #13
Randy Smith (Not in Mondays)
The SavePackage code looks basically good. I haven't reviewed the render side code as I ...
5 years, 3 months ago (2015-09-16 20:48:49 UTC) #14
Randy Smith (Not in Mondays)
On 2015/09/16 20:48:49, rdsmith wrote: > The SavePackage code looks basically good. I haven't reviewed ...
5 years, 3 months ago (2015-09-16 20:49:30 UTC) #15
Łukasz Anforowicz
On 2015/09/16 20:49:30, rdsmith wrote: > On 2015/09/16 20:48:49, rdsmith wrote: > > The SavePackage ...
5 years, 3 months ago (2015-09-16 22:24:36 UTC) #16
Łukasz Anforowicz
Randy, can you take another look please? https://codereview.chromium.org/1308113008/diff/160001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/160001/content/browser/download/save_package.cc#newcode1164 content/browser/download/save_package.cc:1164: DCHECK_EQ(0, number_of_frames_pending_response_); ...
5 years, 3 months ago (2015-09-16 22:47:30 UTC) #17
nasko
LGTM with a nit. https://codereview.chromium.org/1308113008/diff/160001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/160001/content/browser/download/save_package.cc#newcode1168 content/browser/download/save_package.cc:1168: DCHECK_LT(0, number_of_frames_pending_response_); On 2015/09/16 22:47:30, ...
5 years, 3 months ago (2015-09-17 21:18:24 UTC) #18
Randy Smith (Not in Mondays)
Just looking for someone to tell me that I don't need to worry about synchronous ...
5 years, 3 months ago (2015-09-17 22:04:37 UTC) #19
nasko
On 2015/09/17 22:04:37, rdsmith wrote: > Just looking for someone to tell me that I ...
5 years, 3 months ago (2015-09-17 23:31:01 UTC) #20
Randy Smith (Not in Mondays)
On 2015/09/17 23:31:01, nasko (slow to review) wrote: > On 2015/09/17 22:04:37, rdsmith wrote: > ...
5 years, 3 months ago (2015-09-17 23:36:14 UTC) #21
chromium-reviews
I think the question will be clearer when you look at: https://codereview.chromium.org/1308113008/diff/160001/content/browser/download/save_package.cc#newcode1168 AFAIK Randy is ...
5 years, 3 months ago (2015-09-17 23:43:06 UTC) #22
Randy Smith (Not in Mondays)
On 2015/09/17 23:43:06, chromium-reviews wrote: > I think the question will be clearer when you ...
5 years, 3 months ago (2015-09-18 16:07:32 UTC) #23
nasko
On 2015/09/18 16:07:32, rdsmith wrote: > On 2015/09/17 23:43:06, chromium-reviews wrote: > > I think ...
5 years, 3 months ago (2015-09-18 17:15:49 UTC) #24
Łukasz Anforowicz
https://codereview.chromium.org/1308113008/diff/180001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1308113008/diff/180001/content/browser/download/save_package.cc#newcode1191 content/browser/download/save_package.cc:1191: if (!u.is_valid()) { On 2015/09/17 21:18:24, nasko (slow to ...
5 years, 3 months ago (2015-09-18 18:44:19 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1308113008/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1308113008/220001
5 years, 3 months ago (2015-09-18 18:45:03 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/115277)
5 years, 3 months ago (2015-09-18 18:58:23 UTC) #30
Łukasz Anforowicz
Nasko/Randy - I realized that I also need to make changes in savable_resources_browsertest.cc (patchset #13 ...
5 years, 3 months ago (2015-09-18 22:27:58 UTC) #31
nasko
On 2015/09/18 22:27:58, Łukasz Anforowicz wrote: > Nasko/Randy - I realized that I also need ...
5 years, 3 months ago (2015-09-18 23:16:33 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1308113008/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1308113008/240001
5 years, 3 months ago (2015-09-18 23:30:50 UTC) #35
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 3 months ago (2015-09-18 23:37:32 UTC) #36
commit-bot: I haz the power
5 years, 3 months ago (2015-09-18 23:38:09 UTC) #37
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/6af746b740287560dbc9e85d22738000bc72b521
Cr-Commit-Position: refs/heads/master@{#349809}

Powered by Google App Engine
This is Rietveld 408576698