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

Issue 2510083003: PlzNavigate: properly update NavigationHandle for 204/205 and download responses (Closed)

Created:
4 years, 1 month ago by yzshen1
Modified:
3 years, 11 months ago
Reviewers:
clamy
CC:
chromium-reviews, creis+watch_chromium.org, nasko+codewatch_chromium.org, jam, Randy Smith (Not in Mondays), loading-reviews+metrics_chromium.org, csharrison+watch_chromium.org, darin-cc_chromium.org, loading-reviews_chromium.org, mmenke
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

PlzNavigate: properly update NavigationHandle for 204/205 and download responses. This fixes the following browser test for PlzNavigate: PageLoadMetricsBrowserTest.Ignore204Pages PageLoadMetricsBrowserTest.IgnoreDownloads BUG=652767 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Total comments: 3

Patch Set 4 : . #

Patch Set 5 : . #

Patch Set 6 : . #

Total comments: 7

Patch Set 7 : address comments of clamy@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -26 lines) Patch
M content/browser/frame_host/navigation_handle_impl.cc View 1 2 3 4 5 6 1 chunk +17 lines, -0 lines 0 comments Download
M content/browser/frame_host/navigation_request.cc View 1 2 3 4 5 6 2 chunks +7 lines, -13 lines 0 comments Download
M content/browser/loader/navigation_resource_handler.cc View 1 2 3 4 5 6 2 chunks +8 lines, -13 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_unittest.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 25 (18 generated)
yzshen1
Hi, Camille. Would you please take a look? Thanks! https://codereview.chromium.org/2510083003/diff/40001/content/browser/frame_host/navigation_handle_impl.cc File content/browser/frame_host/navigation_handle_impl.cc (right): https://codereview.chromium.org/2510083003/diff/40001/content/browser/frame_host/navigation_handle_impl.cc#newcode631 content/browser/frame_host/navigation_handle_impl.cc:631: ...
4 years, 1 month ago (2016-11-18 00:10:53 UTC) #6
clamy
Thanks! One comment below. I'm fine with setting the error code, the issue seems to ...
4 years, 1 month ago (2016-11-21 16:57:14 UTC) #7
yzshen1
Thanks, Camille! https://codereview.chromium.org/2510083003/diff/40001/content/browser/frame_host/navigation_request.cc File content/browser/frame_host/navigation_request.cc (left): https://codereview.chromium.org/2510083003/diff/40001/content/browser/frame_host/navigation_request.cc#oldcode387 content/browser/frame_host/navigation_request.cc:387: response->head.headers->response_code() == 205)) { On 2016/11/21 16:57:14, ...
4 years, 1 month ago (2016-11-21 17:52:50 UTC) #8
yzshen1
Friendly ping, Camille. I also updated the CL to handle the download case. PTAL
4 years ago (2016-11-23 19:53:57 UTC) #12
clamy
Thanks! A few comments below. https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_host/navigation_handle_impl.cc File content/browser/frame_host/navigation_handle_impl.cc (right): https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_host/navigation_handle_impl.cc#newcode629 content/browser/frame_host/navigation_handle_impl.cc:629: const bool is_204_205_response = ...
4 years ago (2016-11-25 10:46:00 UTC) #19
yzshen1
Thanks, Camille! https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_host/navigation_handle_impl.cc File content/browser/frame_host/navigation_handle_impl.cc (right): https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_host/navigation_handle_impl.cc#newcode629 content/browser/frame_host/navigation_handle_impl.cc:629: const bool is_204_205_response = On 2016/11/25 10:46:00, ...
4 years ago (2016-11-28 22:03:59 UTC) #22
clamy
4 years ago (2016-11-30 17:44:03 UTC) #25
https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_...
File content/browser/frame_host/navigation_handle_impl.cc (right):

https://codereview.chromium.org/2510083003/diff/100001/content/browser/frame_...
content/browser/frame_host/navigation_handle_impl.cc:629: const bool
is_204_205_response =
On 2016/11/28 22:03:59, yzshen1 wrote:
> On 2016/11/25 10:46:00, clamy (slow) wrote:
> > I'm still not super happy about the code flow here for several reasons:
> > 1) Architecturally, this function is supposed to go through all the
throttles
> > and check their results. It's weird to have some special case above which
> > cancels things. I would prefer we cancel things in WillProcessResponse
before
> we
> > call this function.
> 
> Done.
> 
> > 2) More importantly, this will now cause us to possibly spawn a process in
> > downloads and 204, 205s only to delete it moments later. This is quite
> wasteful
> > IMO, so I'd like to avoid that.
> 
> It seems to me that one simple way to avoid this is to split the current
> NavigationHandleImpl::WillProcessResponse() into two calls, e.g. (better names
> needed):
>  - UpdateResponseInfo() which just sets response
> header/is_download/is_stream/etc. and
>  - ThrottleCheckForWillProcessResponse() which runs the throttle checks.
> 
> And then in NavigationRequest::OnResponseStarted(), we do:
> 
> =============================================
> ...
> navigation_handle_->UpdateResponseInfo(...);
> 
> if (navigation is 204/205 or download) {
>   frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
>         navigation_handle_.get());
>   frame_tree_node_->ResetNavigationRequest(false);
>   return;
> }
> 
> // select appropriate renderer, maybe spawn new process.
> 
> navigation_handle_->ThrottleCheckForWillProcessResponse();
> =============================================
> 
> If merging NavigationRequest/NavigationHandle will take a while to happen,
maybe
> we could do such a simple fix so that the issue won't block some browser tests
> or shipping PlzNavigation.
> 
> > 
> > In order to avoid the issue above, I don't see a better way but to merge
> > NavigationRequest & NavigationHandle. This is something I've been wanting to
> do
> > eventually when PlzNavigate ships, so I'll have a try at it and see what it
> > looks like. In the meantime, I'd suggest splitting the CL in two, with the
> part
> > about propagating the is_download bit in one CL, and the part about handling
> > 204/205s in NavigationHandle in another.
> 
> I have created a separate CL for propagating is_download/is_stream/request_id:
> https://codereview.chromium.org/2537593002/

Yes this is something we could do as well. Let me first see if I can get to a CL
with the merge quickly enough, otnerwise we'll move to the code you suggested.
Thanks!

Powered by Google App Engine
This is Rietveld 408576698