CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
Committed: https://crrev.com/e6a4575cd18e48c18e7d5f5183e2fc17e537b725
Cr-Commit-Position: refs/heads/master@{#410868}
Description was changed from ========== keys with ignoreSearch BUG= ========== to ========== keys with ignoreSearch ...
4 years, 10 months ago
(2016-02-22 16:29:30 UTC)
#1
Description was changed from
==========
keys with ignoreSearch
BUG=
==========
to
==========
keys with ignoreSearch
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
zino
Description was changed from ========== keys with ignoreSearch TODO: unittest TODO: write a layout test ...
4 years, 10 months ago
(2016-02-24 18:25:07 UTC)
#2
Description was changed from
==========
keys with ignoreSearch
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
to
==========
[WIP] keys with ignoreSearch
TODO: send request object from Blink to Chromium.
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
4 years, 10 months ago
(2016-02-24 18:31:30 UTC)
#5
I'm not working on it, go for it.
zino
Description was changed from ========== [WIP] keys with ignoreSearch TODO: send request object from Blink ...
4 years, 10 months ago
(2016-02-26 04:03:40 UTC)
#6
Description was changed from
==========
[WIP] keys with ignoreSearch
TODO: send request object from Blink to Chromium.
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
to
==========
[WIP] keys with ignoreSearch
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
zino
Description was changed from ========== [WIP] keys with ignoreSearch TODO: unittest TODO: write a layout ...
4 years, 9 months ago
(2016-03-02 16:42:09 UTC)
#7
Description was changed from
==========
[WIP] keys with ignoreSearch
TODO: unittest
TODO: write a layout test for cache-keys.
TODO: write a layout test for credentials
BUG=
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.This CL
is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=
==========
zino
Description was changed from ========== CacheStorage: Expand cache.keys() method. Current implementation of the method is ...
4 years, 9 months ago
(2016-03-02 16:42:24 UTC)
#8
Description was changed from
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.This CL
is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=
==========
zino
Description was changed from ========== CacheStorage: Expand cache.keys() method. Current implementation of the method is ...
4 years, 9 months ago
(2016-03-02 16:44:10 UTC)
#9
Description was changed from
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
4 years, 9 months ago
(2016-03-02 16:49:20 UTC)
#12
Patchset #2 (id:20001) has been deleted
zino
Patchset #2 (id:40001) has been deleted
4 years, 9 months ago
(2016-03-02 16:49:29 UTC)
#13
Patchset #2 (id:40001) has been deleted
zino
Please take a look. Thank you.
4 years, 9 months ago
(2016-03-02 16:51:06 UTC)
#14
Please take a look.
Thank you.
zino
On 2016/03/02 16:51:06, zino wrote: > Please take a look. > > Thank you. FYI, ...
4 years, 9 months ago
(2016-03-03 09:44:48 UTC)
#15
On 2016/03/02 16:51:06, zino wrote:
> Please take a look.
>
> Thank you.
FYI, I've just fixed unit test error on trybot.
zino
Patchset #5 (id:120001) has been deleted
4 years, 9 months ago
(2016-03-03 12:40:52 UTC)
#16
Patchset #5 (id:120001) has been deleted
jkarlin
Overall looking good but please see the last comment as I think another CL should ...
4 years, 9 months ago
(2016-03-04 14:39:09 UTC)
#17
Overall looking good but please see the last comment as I think another CL
should come before this one.
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
File content/browser/cache_storage/cache_storage_cache.cc (right):
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:246: explicit
KeysContext(scoped_ptr<ServiceWorkerFetchRequest> request,
Remove explicit
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1157: // loops
comment formatting, you have an extra newline here
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1181: void
CacheStorageCache::KeyDidOpenEntry(
Should be KeysDidOpenEntry to show that it's a continuation of the keys
function.
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1202: void
CacheStorageCache::KeyDidReadMetadata(
Should be KeysDidReadMetadata
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1209: if (metadata) {
Start with the failed case and return early:
e.g.,
if (!metadata) {
entry->Doom();
callback.Run(CACHE_STORAGE_OK, std::move(requests));
return;
}
...
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1221: }
Lines 1210-1221 could be put in a new
PopulateFetchRequestFromMetadata function akin to PopulateResponseMetadata (this
should be moved to anonymous namespace and renamed to
PopulateResponseFromMetadata).
namespace {
void PopulateFetchRequestFromMetadata(const CacheMetadata& metadata,
ServiceWorkerFetchRequest* request) {
...
}
} // namespace
https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:1253: if
(keys_context->options.ignore_search) {
This CL adds what is essentially a third implementation of the Query Cache
algorithm. It's time to consolidate.
In a separate CL, please create something like the following and update Match
and Delete to use it:
struct RequestAndResponse {
scoped_ptr<ServiceWorkerFetchRequest> request;
scoped_ptr<ServiceWorkerResponse> response;
BlobDataHandle response_body_handle;
};
using CacheQueryResults = std::vector<RequestAndResponse>;
using CacheQueryResultsCallback = base::Callback<void(CacheQueryResults)>;
void CacheStorageCache::QueryCache(scoped_ptr<ServiceWorkerFetchRequest>
request, const CacheStorageCacheQueryParams& match_params, const
CacheQueryResultsCallback& callback) {
// Perform
http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a...
here
}
Then in this CL use your new method for Keys as well.
zino
Patchset #6 (id:160001) has been deleted
4 years, 4 months ago
(2016-08-01 15:04:22 UTC)
#18
Patchset #6 (id:160001) has been deleted
zino
Patchset #6 (id:180001) has been deleted
4 years, 4 months ago
(2016-08-01 15:24:01 UTC)
#19
Patchset #6 (id:180001) has been deleted
zino
Patchset #6 (id:200001) has been deleted
4 years, 4 months ago
(2016-08-01 18:36:20 UTC)
#20
Patchset #6 (id:200001) has been deleted
zino
Description was changed from ========== CacheStorage: Expand cache.keys() method. Current implementation of the method is ...
4 years, 4 months ago
(2016-08-02 01:07:18 UTC)
#21
Description was changed from
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec and fixing a typo in Cache.idl
as well.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
zino
Reviewers, Please take a look at PatchSet6. Thank you
4 years, 4 months ago
(2016-08-02 01:09:20 UTC)
#22
Reviewers,
Please take a look at PatchSet6.
Thank you
nhiroki
Partially reviewed. I'll take another look later. https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc#newcode632 content/browser/cache_storage/cache_storage_cache.cc:632: !query_cache_results->request->url.is_empty()) { ...
4 years, 4 months ago
(2016-08-02 07:31:06 UTC)
#23
Partially reviewed. I'll take another look later.
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
File content/browser/cache_storage/cache_storage_cache.cc (right):
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:632:
!query_cache_results->request->url.is_empty()) {
Hm... I assumed that the diskcache always returns a valid request and request's
url is not empty. Did you hit DCHECK(query_cache_results->request) in the
original code?
If request is null or url is empty, I think we should immediately proceed to the
next entry instead of trying to read metadata.
jkarlin
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache_unittest.cc File content/browser/cache_storage/cache_storage_cache_unittest.cc (right): https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache_unittest.cc#newcode1057 content/browser/cache_storage/cache_storage_cache_unittest.cc:1057: expected_keys.push_back(body_request_with_query_.url.spec()); You can use vector initializers now, so this ...
4 years, 4 months ago
(2016-08-02 12:06:20 UTC)
#24
Thank you for review. https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc#newcode632 content/browser/cache_storage/cache_storage_cache.cc:632: !query_cache_results->request->url.is_empty()) { On 2016/08/02 07:31:06, ...
4 years, 4 months ago
(2016-08-02 17:37:42 UTC)
#25
Thank you for review.
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
File content/browser/cache_storage/cache_storage_cache.cc (right):
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:632:
!query_cache_results->request->url.is_empty()) {
On 2016/08/02 07:31:06, nhiroki wrote:
> Hm... I assumed that the diskcache always returns a valid request and
request's
> url is not empty. Did you hit DCHECK(query_cache_results->request) in the
> original code?
Yes, diskcache always returns a valid request and request's url is not empty but
The query_cache_results->request is a optional argument of
keys(request, options) or other things. So, it can be null or empty.
If the name(query_cache_results->request) is confusing, we can rename it.
In the original code, we asserted that the request is not null if only
ignore_search is true.
But it could still be null or empty url if ignore_search is false.
Also, the spec says like this (e.g. keys()):
...
2. If the optional argument request is omitted, then:
1. For each fetching record entry of its request to response map,
in key insertion order:
1. Add entry.[[key]] to resultArray.
3. Else:
...
4. Let requestResponseArray be the result of running Query Cache algorithm
passing a Request object that represents r and options as the arguments.
In terms of implementation, I thought that the number 2(for each) could merge
into
the number 4(Query Cache) in order to reduce repeated codes unnecessarily.
>
> If request is null or url is empty, I think we should immediately proceed to
the
> next entry instead of trying to read metadata.
So, I thought we should read metadata if request is null or url is empty.
What do you think?
If you are agree with me, I'll leave comments here.
If I'm wrong, please let me know better way :)
Thank you!
nhiroki
LGTM (sorry for my delayed reply) https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache.cc#newcode632 content/browser/cache_storage/cache_storage_cache.cc:632: !query_cache_results->request->url.is_empty()) { On ...
4 years, 4 months ago
(2016-08-08 12:40:55 UTC)
#26
LGTM (sorry for my delayed reply)
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
File content/browser/cache_storage/cache_storage_cache.cc (right):
https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_...
content/browser/cache_storage/cache_storage_cache.cc:632:
!query_cache_results->request->url.is_empty()) {
On 2016/08/02 17:37:42, zino wrote:
> On 2016/08/02 07:31:06, nhiroki wrote:
> > Hm... I assumed that the diskcache always returns a valid request and
> request's
> > url is not empty. Did you hit DCHECK(query_cache_results->request) in the
> > original code?
>
> Yes, diskcache always returns a valid request and request's url is not empty
but
> The query_cache_results->request is a optional argument of
> keys(request, options) or other things. So, it can be null or empty.
> If the name(query_cache_results->request) is confusing, we can rename it.
Oh, I wrongly assumed |query_cache_results->request| is returned from a disk
cache. I think current naming is appropriate and you don't have to rename it, I
misread it though :p
> In the original code, we asserted that the request is not null if only
> ignore_search is true.
> But it could still be null or empty url if ignore_search is false.
>
> Also, the spec says like this (e.g. keys()):
> ...
> 2. If the optional argument request is omitted, then:
> 1. For each fetching record entry of its request to response map,
> in key insertion order:
> 1. Add entry.[[key]] to resultArray.
> 3. Else:
> ...
> 4. Let requestResponseArray be the result of running Query Cache algorithm
> passing a Request object that represents r and options as the
arguments.
>
> In terms of implementation, I thought that the number 2(for each) could merge
> into
> the number 4(Query Cache) in order to reduce repeated codes unnecessarily.
>
> >
> > If request is null or url is empty, I think we should immediately proceed to
> the
> > next entry instead of trying to read metadata.
>
> So, I thought we should read metadata if request is null or url is empty.
> What do you think?
> If you are agree with me, I'll leave comments here.
> If I'm wrong, please let me know better way :)
>
> Thank you!
Looks good. Thank you for the clarification :)
https://codereview.chromium.org/1719103002/diff/220001/third_party/WebKit/Lay...
File
third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js
(right):
https://codereview.chromium.org/1719103002/diff/220001/third_party/WebKit/Lay...
third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-keys.js:43:
{ignoreSearch: true})
Args don't need 4-spaces indent.
zino
Thank you for review. I addressed all of comments. https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache_unittest.cc File content/browser/cache_storage/cache_storage_cache_unittest.cc (right): https://codereview.chromium.org/1719103002/diff/220001/content/browser/cache_storage/cache_storage_cache_unittest.cc#newcode1057 content/browser/cache_storage/cache_storage_cache_unittest.cc:1057: ...
4 years, 4 months ago
(2016-08-08 16:36:03 UTC)
#27
Description was changed from ========== CacheStorage: Expand cache.keys() method. Current implementation of the method is ...
4 years, 4 months ago
(2016-08-09 23:39:02 UTC)
#34
Message was sent while issue was closed.
Description was changed from
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
commit-bot: I haz the power
Committed patchset #8 (id:260001)
4 years, 4 months ago
(2016-08-09 23:39:03 UTC)
#35
Message was sent while issue was closed.
Committed patchset #8 (id:260001)
commit-bot: I haz the power
Description was changed from ========== CacheStorage: Expand cache.keys() method. Current implementation of the method is ...
4 years, 4 months ago
(2016-08-09 23:41:21 UTC)
#36
Message was sent while issue was closed.
Description was changed from
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
==========
to
==========
CacheStorage: Expand cache.keys() method.
Current implementation of the method is always return all of keys even if it
takes optional parameters. According to ServiceWorkerSpec[1], the method should
take a request object and cache query options[2] as optional parameters.
This CL is expanding the method as per the spec.
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-keys
[2] Currenly, only supports ignoreSearch option like matchAll(), delete()
BUG=520784
Committed: https://crrev.com/e6a4575cd18e48c18e7d5f5183e2fc17e537b725
Cr-Commit-Position: refs/heads/master@{#410868}
==========
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/e6a4575cd18e48c18e7d5f5183e2fc17e537b725 Cr-Commit-Position: refs/heads/master@{#410868}
4 years, 4 months ago
(2016-08-09 23:41:25 UTC)
#37
Issue 1719103002: CacheStorage: Expand cache.keys() method.
(Closed)
Created 4 years, 10 months ago by zino
Modified 4 years, 4 months ago
Reviewers: jkarlin, nhiroki, philipj_slow
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 25