|
|
DescriptionCacheStorage: Introduce QueryCache algorithm.
This CL is introducing QueryCache[1] algorithm. The algorithm is used to get
requestResponseArray from target storage. (e.g. in matchAll())
This CL is triggered from a comment in [2].
[1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-algorithm
[2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_storage/cache_storage_cache.cc#newcode1253
BUG=none
TEST=existing tests
Committed: https://crrev.com/75bb5a5bbf404324c5eb6f8d26d2581fb1a13f25
Cr-Commit-Position: refs/heads/master@{#408381}
Patch Set 1 #Patch Set 2 #
Total comments: 18
Patch Set 3 : addressed comments #Patch Set 4 : reupload #
Total comments: 2
Patch Set 5 : fix win bot failing #
Messages
Total messages: 20 (6 generated)
Description was changed from ========== remove First BUG= ========== to ========== CacheStorage: Introduce QueryCache algorithm. This CL is introducing QueryCache[1] algorithm. The algorithm is used to get requestResponseArray from target storage. (e.g. in matchAll()) This CL is triggered from a comment in [2]. [1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a... [2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_... BUG=none TEST=existing tests ==========
jinho.bang@samsung.com changed reviewers: + jkarlin@chromium.org, nhiroki@chromium.org
PTAL owners. Sorry, too late. I'm not sure if this is a right way. Could you review this and give me inputs?
Gentle ping PTAL.
Sorry for the delayed reply. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:327: base::Passed(std::move(request)), match_params, pending_callback)); nit: please wrap at 80 columns https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:685: PopulateRequestFromMetadata(*metadata, & request); There is an extra space between "&" and "request". https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:811: const ResponsesCallback& callback) { Indents look broken. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:830: if (error != CACHE_STORAGE_OK || !query_cache_results) { I suspect the latter condition |!query_cache_results| is never satisfied because it should be non-null whenever |error| is OK. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:831: callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Responses>(), We should pass |error| to the callback in order not to lose information. For example, ERROR_NOT_FOUND is a meaningful error code for MatchAll (see CacheStorageDispatcherHost::OnCacheMatchAllCallback) https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1314: std::unique_ptr<ServiceWorkerFetchRequest> request(new ServiceWorkerFetchRequest); nit (80 columns) https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1326: callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Requests>()); ditto (|!query_cache_results| and an error code) https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1515: GURL(metadata.response().url()), metadata.request().method(), Regarding the first argument of ServiceWorkerFetchRequest(), the original code uses |entry->GetKey()| that is a URL of a request, but this code uses response's URL. I guess these can be different, for example, when a responses is stored by Cache.put(). https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.h (right): https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.h:367: void PendingQueryCacheResultsCallback( You may be able to avoid this pattern after jkarlin@'s refactoring: https://codereview.chromium.org/2167483002/
Thank you for review. I addressed comments. PTAL. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:327: base::Passed(std::move(request)), match_params, pending_callback)); On 2016/07/20 15:44:16, nhiroki (slow) wrote: > nit: please wrap at 80 columns Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:685: PopulateRequestFromMetadata(*metadata, & request); On 2016/07/20 15:44:17, nhiroki (slow) wrote: > There is an extra space between "&" and "request". Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:811: const ResponsesCallback& callback) { On 2016/07/20 15:44:17, nhiroki (slow) wrote: > Indents look broken. Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:830: if (error != CACHE_STORAGE_OK || !query_cache_results) { On 2016/07/20 15:44:17, nhiroki (slow) wrote: > I suspect the latter condition |!query_cache_results| is never satisfied because > it should be non-null whenever |error| is OK. Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:831: callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Responses>(), On 2016/07/20 15:44:16, nhiroki (slow) wrote: > We should pass |error| to the callback in order not to lose information. For > example, ERROR_NOT_FOUND is a meaningful error code for MatchAll (see > CacheStorageDispatcherHost::OnCacheMatchAllCallback) Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1314: std::unique_ptr<ServiceWorkerFetchRequest> request(new ServiceWorkerFetchRequest); On 2016/07/20 15:44:17, nhiroki (slow) wrote: > nit (80 columns) Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1326: callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Requests>()); On 2016/07/20 15:44:17, nhiroki (slow) wrote: > ditto (|!query_cache_results| and an error code) Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1515: GURL(metadata.response().url()), metadata.request().method(), On 2016/07/20 15:44:17, nhiroki (slow) wrote: > Regarding the first argument of ServiceWorkerFetchRequest(), the original code > uses |entry->GetKey()| that is a URL of a request, but this code uses response's > URL. I guess these can be different, for example, when a responses is stored by > Cache.put(). Done. https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.h (right): https://codereview.chromium.org/2137833002/diff/20001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.h:367: void PendingQueryCacheResultsCallback( On 2016/07/20 15:44:17, nhiroki (slow) wrote: > You may be able to avoid this pattern after jkarlin@'s refactoring: > https://codereview.chromium.org/2167483002/ Done.
I cannot see changes in cache_storage_cache.cc on the patchset 3. Could you re-upload it?
On 2016/07/24 13:50:41, nhiroki (slow) wrote: > I cannot see changes in cache_storage_cache.cc on the patchset 3. Could you > re-upload it? Sure. I've just reuploaded :)
On 2016/07/24 13:50:41, nhiroki (slow) wrote: > I cannot see changes in cache_storage_cache.cc on the patchset 3. Could you > re-upload it? Sure. I've just reuploaded :)
LGTM with a minor comment https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:1403: GURL request_url, const GURL&
On 2016/07/25 05:11:45, nhiroki wrote: > LGTM with a minor comment > > https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... > File content/browser/cache_storage/cache_storage_cache.cc (right): > > https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... > content/browser/cache_storage/cache_storage_cache.cc:1403: GURL request_url, > const GURL& Thank you for review. But win bots failed. I don't know why it fails exactly. Could you give me some input (if I'm missing something..)? Anyway.. I'm setting up for win build now.
https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... File content/browser/cache_storage/cache_storage_cache.cc (right): https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... content/browser/cache_storage/cache_storage_cache.cc:623: std::move(query_cache_results)); This is why the windows tests are failing. You're using query_cache_results-> and std::moving it at the same time. On Linux query_cache_results->callbak.Run will resolve before the std::move. On Windows the std::move will happen first.
On 2016/07/28 01:11:36, jkarlin wrote: > https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... > File content/browser/cache_storage/cache_storage_cache.cc (right): > > https://codereview.chromium.org/2137833002/diff/60001/content/browser/cache_s... > content/browser/cache_storage/cache_storage_cache.cc:623: > std::move(query_cache_results)); > This is why the windows tests are failing. You're using query_cache_results-> > and std::moving it at the same time. On Linux query_cache_results->callbak.Run > will resolve before the std::move. On Windows the std::move will happen first. Oh, Thank you for input :)
The CQ bit was checked by jinho.bang@samsung.com
The patchset sent to the CQ was uploaded after l-g-t-m from nhiroki@chromium.org Link to the patchset: https://codereview.chromium.org/2137833002/#ps80001 (title: "fix win bot failing")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== CacheStorage: Introduce QueryCache algorithm. This CL is introducing QueryCache[1] algorithm. The algorithm is used to get requestResponseArray from target storage. (e.g. in matchAll()) This CL is triggered from a comment in [2]. [1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a... [2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_... BUG=none TEST=existing tests ========== to ========== CacheStorage: Introduce QueryCache algorithm. This CL is introducing QueryCache[1] algorithm. The algorithm is used to get requestResponseArray from target storage. (e.g. in matchAll()) This CL is triggered from a comment in [2]. [1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a... [2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_... BUG=none TEST=existing tests ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== CacheStorage: Introduce QueryCache algorithm. This CL is introducing QueryCache[1] algorithm. The algorithm is used to get requestResponseArray from target storage. (e.g. in matchAll()) This CL is triggered from a comment in [2]. [1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a... [2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_... BUG=none TEST=existing tests ========== to ========== CacheStorage: Introduce QueryCache algorithm. This CL is introducing QueryCache[1] algorithm. The algorithm is used to get requestResponseArray from target storage. (e.g. in matchAll()) This CL is triggered from a comment in [2]. [1] http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#query-cache-a... [2] https://codereview.chromium.org/1719103002/diff/100001/content/browser/cache_... BUG=none TEST=existing tests Committed: https://crrev.com/75bb5a5bbf404324c5eb6f8d26d2581fb1a13f25 Cr-Commit-Position: refs/heads/master@{#408381} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/75bb5a5bbf404324c5eb6f8d26d2581fb1a13f25 Cr-Commit-Position: refs/heads/master@{#408381} |