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

Issue 2321343002: Redirect handling in resource prefetch predictor (Closed)

Created:
4 years, 3 months ago by alexilin
Modified:
4 years, 3 months ago
Reviewers:
Benoit L, mattcary
CC:
chromium-reviews, shishir+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Redirect handling in resource prefetch predictor We are going to save information about redirects in resource prefetch predictor to use it later and to prefetch resources associated with the end of redirect chain immediately. BUG=

Patch Set 1 #

Patch Set 2 : test #

Total comments: 10

Patch Set 3 : Intermediate redirects aren't tracked #

Patch Set 4 : Database for redirects + tests for it #

Patch Set 5 : Update some comments #

Total comments: 12

Patch Set 6 : git cl format #

Patch Set 7 : Redirects database schema changed #

Total comments: 20
Unified diffs Side-by-side diffs Delta from patch set Stats (+1348 lines, -263 lines) Patch
M chrome/browser/predictors/resource_prefetch_common.h View 1 2 3 1 chunk +2 lines, -0 lines 1 comment Download
M chrome/browser/predictors/resource_prefetch_common.cc View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/predictors/resource_prefetch_predictor.h View 1 2 3 4 5 6 7 chunks +36 lines, -9 lines 4 comments Download
M chrome/browser/predictors/resource_prefetch_predictor.cc View 1 2 3 4 5 6 17 chunks +207 lines, -54 lines 10 comments Download
M chrome/browser/predictors/resource_prefetch_predictor.proto View 1 2 3 4 5 6 1 chunk +13 lines, -0 lines 1 comment Download
M chrome/browser/predictors/resource_prefetch_predictor_tables.h View 1 2 3 4 5 6 7 chunks +93 lines, -20 lines 4 comments Download
M chrome/browser/predictors/resource_prefetch_predictor_tables.cc View 1 2 3 4 5 6 23 chunks +363 lines, -50 lines 0 comments Download
M chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc View 1 2 3 4 5 6 12 chunks +273 lines, -40 lines 0 comments Download
M chrome/browser/predictors/resource_prefetch_predictor_unittest.cc View 1 2 3 4 5 6 24 chunks +339 lines, -86 lines 0 comments Download
M chrome/browser/ui/webui/predictors/predictors_handler.cc View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 2 chunks +18 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (3 generated)
alexilin
Hi Matt, I've started working on redirect handling in prefetch predictor. I haven't written tests ...
4 years, 3 months ago (2016-09-09 08:27:11 UTC) #2
mattcary
A brief comment, I need to spend some time with the code before verifying correctness. ...
4 years, 3 months ago (2016-09-09 09:16:12 UTC) #3
mattcary
A couple more comments. I'll wait until you've finished the CL, or at least the ...
4 years, 3 months ago (2016-09-09 13:19:21 UTC) #4
alexilin
Some thoughts about handling intermediate redirects. I'll add information about it to discussion https://docs.google.com/a/google.com/document/d/16xZ_DbaXXJK60_zS5oVZdRXJkOkav-aFD9kIrqhkcOI/edit?usp=sharing. https://codereview.chromium.org/2321343002/diff/20001/chrome/browser/predictors/resource_prefetch_predictor.cc ...
4 years, 3 months ago (2016-09-09 13:59:19 UTC) #5
mattcary
https://codereview.chromium.org/2321343002/diff/20001/chrome/browser/predictors/resource_prefetch_predictor.cc File chrome/browser/predictors/resource_prefetch_predictor.cc (right): https://codereview.chromium.org/2321343002/diff/20001/chrome/browser/predictors/resource_prefetch_predictor.cc#newcode1037 chrome/browser/predictors/resource_prefetch_predictor.cc:1037: const std::vector<std::string>& keys, On 2016/09/09 13:59:19, alexilin wrote: > ...
4 years, 3 months ago (2016-09-09 14:14:27 UTC) #6
alexilin
Hi Matt! I've finished with collecting and storing information about redirects. I'm not happy with ...
4 years, 3 months ago (2016-09-14 12:14:28 UTC) #7
mattcary
On 2016/09/14 12:14:28, alexilin wrote: > Hi Matt! > > I've finished with collecting and ...
4 years, 3 months ago (2016-09-14 12:16:49 UTC) #8
mattcary
> I'm not happy with the resulting resource_prefetch_predictor_tables class, > because it is responsible for ...
4 years, 3 months ago (2016-09-14 15:37:00 UTC) #9
mattcary
https://codereview.chromium.org/2321343002/diff/80001/chrome/browser/predictors/resource_prefetch_predictor.cc File chrome/browser/predictors/resource_prefetch_predictor.cc (right): https://codereview.chromium.org/2321343002/diff/80001/chrome/browser/predictors/resource_prefetch_predictor.cc#newcode480 chrome/browser/predictors/resource_prefetch_predictor.cc:480: if (nav_it != inflight_navigations_.end()) Run git cl format; the ...
4 years, 3 months ago (2016-09-14 15:37:09 UTC) #10
alexilin
On 2016/09/14 15:37:00, mattcary wrote: > > I'm not happy with the resulting resource_prefetch_predictor_tables class, ...
4 years, 3 months ago (2016-09-14 16:48:54 UTC) #12
alexilin
Hello Matt, I worked on your comments and also changed redirects table schema. Plz take ...
4 years, 3 months ago (2016-09-14 18:59:55 UTC) #13
mattcary
Still going through your changes but I wanted to respond quickly to two comments. https://codereview.chromium.org/2321343002/diff/80001/chrome/browser/predictors/resource_prefetch_predictor_tables.cc ...
4 years, 3 months ago (2016-09-15 09:04:34 UTC) #14
mattcary
https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h File chrome/browser/predictors/resource_prefetch_predictor_tables.h (right): https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h#newcode104 chrome/browser/predictors/resource_prefetch_predictor_tables.h:104: // Used in the UrlRedirectTable and HostRedirectTable to store ...
4 years, 3 months ago (2016-09-15 09:40:48 UTC) #15
alexilin
https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h File chrome/browser/predictors/resource_prefetch_predictor_tables.h (right): https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h#newcode104 chrome/browser/predictors/resource_prefetch_predictor_tables.h:104: // Used in the UrlRedirectTable and HostRedirectTable to store ...
4 years, 3 months ago (2016-09-15 10:51:49 UTC) #16
mattcary
https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h File chrome/browser/predictors/resource_prefetch_predictor_tables.h (right): https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h#newcode104 chrome/browser/predictors/resource_prefetch_predictor_tables.h:104: // Used in the UrlRedirectTable and HostRedirectTable to store ...
4 years, 3 months ago (2016-09-15 11:44:28 UTC) #17
alexilin
https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h File chrome/browser/predictors/resource_prefetch_predictor_tables.h (right): https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predictors/resource_prefetch_predictor_tables.h#newcode104 chrome/browser/predictors/resource_prefetch_predictor_tables.h:104: // Used in the UrlRedirectTable and HostRedirectTable to store ...
4 years, 3 months ago (2016-09-15 17:56:16 UTC) #18
mattcary
> > > - We probably don't want to have a deal with proto-style containers. ...
4 years, 3 months ago (2016-09-16 08:33:17 UTC) #19
alexilin
Hi Benoit, Here is a CL that I was working for last two weeks. I ...
4 years, 3 months ago (2016-09-19 08:01:54 UTC) #21
Benoit L
On 2016/09/19 08:01:54, alexilin wrote: > Hi Benoit, > > Here is a CL that ...
4 years, 3 months ago (2016-09-19 12:13:47 UTC) #22
alexilin
On 2016/09/19 12:13:47, Benoit L wrote: > On 2016/09/19 08:01:54, alexilin wrote: > > Hi ...
4 years, 3 months ago (2016-09-19 12:39:22 UTC) #23
Benoit L
Per offline discussion, a refactor CL will land first, then an evolution of this one. ...
4 years, 3 months ago (2016-09-19 13:53:48 UTC) #24
Benoit L
On 2016/09/19 13:53:48, Benoit L wrote: > Per offline discussion, a refactor CL will land ...
4 years, 3 months ago (2016-09-19 13:54:40 UTC) #25
alexilin
4 years, 3 months ago (2016-09-19 16:49:26 UTC) #26
https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
File chrome/browser/predictors/resource_prefetch_predictor.cc (right):

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
chrome/browser/predictors/resource_prefetch_predictor.cc:645:
base::Bind(&ResourcePrefetchPredictorTables::GetAllData, tables_,
On 2016/09/19 13:53:47, Benoit L wrote:
> nit: Why not just
> url_data.get() here (and so on for the other ones)?
> 
> Seems like the raw pointers are only used here.

I'm still not very confident with this "passing pointers between threads" thing,
so here I just repeated existing code.

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
chrome/browser/predictors/resource_prefetch_predictor.cc:787: for
(RedirectDataMap::iterator it = data_map->begin(); it != data_map->end();
On 2016/09/19 13:53:47, Benoit L wrote:
> nit: Can you use a range for loop here?

Of course!

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
chrome/browser/predictors/resource_prefetch_predictor.cc:1038: row_to_add.url =
final_redirect;
On 2016/09/19 13:53:47, Benoit L wrote:
> The key is the final redirect url?

No. RedirectRow doesn't have a key at all, it is stored in vector.
I didn't split redirect rows belonging the same initial url into several db
rows.

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
File chrome/browser/predictors/resource_prefetch_predictor.h (right):

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
chrome/browser/predictors/resource_prefetch_predictor.h:103: struct Navigation {
> Navigation and requests are vague, overloaded words. I guess that Navigation
is
> fine here, but "requests" doesn't tell me what this relates to.
> 
> I suspect it's the vector of main resource requests due to redirects. What
about
> main_resource_requests?
This is actually an opposite thing :) This is a vector of subresource requests
only within single navigation. So I think that I should call it
subresource_requests.
This is exactly the same vector that was stored in inflight_navigations_ map
earlier.

> Also, it feels a bit weird for Navigation and NavigationID to be two entirely
> unrelated objects.
Navigation is stored in NavigationMap by NavigationID key. I could add
NavigationID field in Navigation structure but NavigationID is used only as a
key for the map. What kind of relation do you expect?

https://codereview.chromium.org/2321343002/diff/120001/chrome/browser/predict...
chrome/browser/predictors/resource_prefetch_predictor.h:108:
std::vector<URLRequestSummary> requests;
On 2016/09/19 13:53:48, Benoit L wrote:
> Is there some invariant here, such as:
> - requests is not empty
> - requests[0].url == initial_url?
> 
> If so, is it DCHECK()-d somewhere?

Related with misunderstanding in the comment above.
Vector could be empty, it means that we didn't see any subresources within this
navigation.

Powered by Google App Engine
This is Rietveld 408576698