Bug 176202

Summary: Allow retrieving Cache Storage records for a given URL only
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, buildbot, cdumez, cgarcia, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing none

Description youenn fablet 2017-08-31 17:23:43 PDT
For efficiency, allow retrieving Cache Storage records for a given URL only.
Comment 1 youenn fablet 2017-08-31 17:29:54 PDT
Created attachment 319551 [details]
Patch
Comment 2 Build Bot 2017-08-31 17:30:52 PDT
Attachment 319551 [details] did not pass style-queue:


ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:159:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:197:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 youenn fablet 2017-09-01 08:49:00 PDT
Created attachment 319596 [details]
Patch
Comment 4 youenn fablet 2017-09-01 09:49:45 PDT
Created attachment 319605 [details]
Patch
Comment 5 Build Bot 2017-09-01 09:51:07 PDT
Attachment 319605 [details] did not pass style-queue:


ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:159:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:197:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 youenn fablet 2017-09-01 10:18:50 PDT
Created attachment 319610 [details]
Patch
Comment 7 Build Bot 2017-09-01 10:19:59 PDT
Attachment 319610 [details] did not pass style-queue:


ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:159:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:197:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 youenn fablet 2017-09-01 12:27:41 PDT
WPE bots error is unrelated.
Comment 9 Alex Christensen 2017-09-01 14:57:37 PDT
Comment on attachment 319610 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=319610&action=review

> Source/WebCore/Modules/cache/Cache.cpp:388
> +    retrieveURL.setQuery({ });

Do we want to remove the fragment here, too?

> Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:104
> +    if (keyURL.hasQuery())
> +        keyURL.setQuery({ });
> +    keyURL.removeFragmentIdentifier();

Maybe we should make a method to do both of these at the same time.  That would avoid an unnecessary string allocation and copy.

> Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:116
> +    Vector<Record> newRecords;
> +    newRecords.reserveInitialCapacity(1);
> +    newRecords.uncheckedAppend(WTFMove(record));
> +    return m_records.set(key, WTFMove(newRecords)).iterator->value.last();

{ WTFMove(record) }
Comment 10 youenn fablet 2017-09-05 09:34:55 PDT
Created attachment 319905 [details]
Patch for landing
Comment 11 Build Bot 2017-09-05 09:36:47 PDT
Attachment 319905 [details] did not pass style-queue:


ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:159:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:197:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 youenn fablet 2017-09-05 09:40:59 PDT
Thanks for the review.

(In reply to Alex Christensen from comment #9)
> Comment on attachment 319610 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=319610&action=review
> 
> > Source/WebCore/Modules/cache/Cache.cpp:388
> > +    retrieveURL.setQuery({ });
> 
> Do we want to remove the fragment here, too?

OK

> > Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:104
> > +    if (keyURL.hasQuery())
> > +        keyURL.setQuery({ });
> > +    keyURL.removeFragmentIdentifier();
> 
> Maybe we should make a method to do both of these at the same time.  That
> would avoid an unnecessary string allocation and copy.

Will do in a follow-up
 
> > Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:116
> > +    Vector<Record> newRecords;
> > +    newRecords.reserveInitialCapacity(1);
> > +    newRecords.uncheckedAppend(WTFMove(record));
> > +    return m_records.set(key, WTFMove(newRecords)).iterator->value.last();
> 
> { WTFMove(record) }

That is not working.
Probably need a tweak in Vector.h.
I'll try to fix that in a follow-up.
Comment 13 WebKit Commit Bot 2017-09-05 10:52:55 PDT
Comment on attachment 319905 [details]
Patch for landing

Clearing flags on attachment: 319905

Committed r221624: <http://trac.webkit.org/changeset/221624>
Comment 14 WebKit Commit Bot 2017-09-05 10:52:57 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Radar WebKit Bug Importer 2017-09-27 12:43:42 PDT
<rdar://problem/34693839>