Bug 197736

Summary: Limit number of prefetches of a given page
Product: WebKit Reporter: Rob Buis <rbuis>
Component: Page LoadingAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, cgarcia, commit-queue, darin, ews-watchlist, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Rob Buis 2019-05-09 05:39:25 PDT
For now a first approach is to just allow one unique url.
Comment 1 Rob Buis 2019-05-09 05:50:01 PDT
Created attachment 369487 [details]
Patch
Comment 2 Rob Buis 2019-05-09 06:49:27 PDT
Created attachment 369489 [details]
Patch
Comment 3 Darin Adler 2019-05-09 10:25:38 PDT
Comment on attachment 369489 [details]
Patch

It’s unnecessary to design this so that it requires two separate functions in PrefetchCache and extra hash table lookups. Instead we could simply implement this policy in the prefetch cache itself. We would use add instead of set inside PrefetchCache::store, check the return value and return early if there’s already a prefetch for the URL. Currently, the single caller doesn’t even need to know whether the prefetch was done or not so we wouldn’t have to change anything outside that function.
Comment 4 Rob Buis 2019-05-09 11:33:50 PDT
Created attachment 369500 [details]
Patch
Comment 5 Rob Buis 2019-05-09 11:36:03 PDT
(In reply to Darin Adler from comment #3)
> It’s unnecessary to design this so that it requires two separate functions
> in PrefetchCache and extra hash table lookups. Instead we could simply
> implement this policy in the prefetch cache itself. We would use add instead
> of set inside PrefetchCache::store, check the return value and return early
> if there’s already a prefetch for the URL. Currently, the single caller
> doesn’t even need to know whether the prefetch was done or not so we
> wouldn’t have to change anything outside that function.

Much better, thanks! I updated the patch.
Comment 6 WebKit Commit Bot 2019-05-09 23:44:19 PDT
Comment on attachment 369500 [details]
Patch

Clearing flags on attachment: 369500

Committed r245171: <https://trac.webkit.org/changeset/245171>
Comment 7 WebKit Commit Bot 2019-05-09 23:44:21 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-05-09 23:45:18 PDT
<rdar://problem/50653992>