Bug 197736 - Limit number of prefetches of a given page
Summary: Limit number of prefetches of a given page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-09 05:39 PDT by Rob Buis
Modified: 2019-05-09 23:45 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.37 KB, patch)
2019-05-09 05:50 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.37 KB, patch)
2019-05-09 06:49 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (1.77 KB, patch)
2019-05-09 11:33 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>