Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Issue 1375293004: ServiceWorkerWriteToCacheJob: refactor (Closed)

Created:
5 years, 2 months ago by Elly Fong-Jones
Modified:
5 years, 2 months ago
Reviewers:
michaeln, *falken, mmenke
CC:
chromium-reviews, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, jam, nhiroki, darin-cc_chromium.org, horo+watch_chromium.org, kinuko+serviceworker, kinuko+watch, blink-worker-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

ServiceWorkerWriteToCacheJob: refactor This CL is a re-land of a previously reviewed and approved CL that was reverted: https://codereview.chromium.org/1356153002/ ServiceWorkerWriteToCacheJob is a subclass of URLRequestJob that is responsible for filling and updating a write-through cache for ServiceWorker data. Specifically, ServiceWorkerWriteToCacheJob creates an underlying URLRequestJob which it uses to do the actual network request for the script, then returns the script body to the creator of the ServiceWorkerWriteToCacheJob while also storing it in the ServiceWorker cache if it has been updated. In order to avoid spurious cache rewrites, ServiceWorkerWriteToCacheJob defers writing an entry for as long as possible: if there is an existing entry, it compares incoming network data to the cache entry's data, and only starts writing once there is a mismatch. Since the mismatch may occur after much data has already been handled, once this happens ServiceWorkerWriteToCacheJob must transparently copy all the existing data up to that point from the cache, then resume streaming network data into the cache and back to its consumer. This is the "compare-and-copy" process. If there is no existing entry, network data is streamed directly to the cache; this is the "passthrough" process. This CL removes the code implementing the compare-and-copy and passthrough processes from ServiceWorkerWriteToCacheJob and moves it into a separate class, ServiceWorkerCacheWriter. ServiceWorkerCacheWriter exposes an asynchronous API for overwriting a single cache entry that is now used by ServiceWorkerWriteToCacheJob. BUG=474859 TBR=jochen,falken Committed: https://crrev.com/7320022d75696c0f0b4ea02ed801fbbec4783658 Cr-Commit-Position: refs/heads/master@{#352593}

Patch Set 1 : Clean version #

Patch Set 2 : Fail requests that don't replace the incumbent #

Total comments: 18

Patch Set 3 : Documentation & naming fixes #

Total comments: 2

Patch Set 4 : NotifyFinishedCaching with the real status #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1593 lines, -505 lines) Patch
M content/browser/appcache/appcache_response.h View 2 chunks +7 lines, -4 lines 0 comments Download
A content/browser/service_worker/service_worker_cache_writer.h View 1 chunk +230 lines, -0 lines 0 comments Download
A content/browser/service_worker/service_worker_cache_writer.cc View 1 chunk +498 lines, -0 lines 0 comments Download
A content/browser/service_worker/service_worker_cache_writer_unittest.cc View 1 chunk +697 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_write_to_cache_job.h View 5 chunks +20 lines, -22 lines 0 comments Download
M content/browser/service_worker/service_worker_write_to_cache_job.cc View 1 2 3 17 chunks +138 lines, -479 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 28 (8 generated)
mmenke
On 2015/10/01 18:04:26, Elly Jones wrote: > mailto:ellyjones@chromium.org changed reviewers: > + mailto:mmenke@chromium.org Sorry I ...
5 years, 2 months ago (2015-10-01 21:17:31 UTC) #2
mmenke
Think I'm going to have to defer to the service worker people on this one ...
5 years, 2 months ago (2015-10-01 22:01:45 UTC) #3
michaeln
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/01 22:01:45, mmenke wrote: > So in ...
5 years, 2 months ago (2015-10-02 00:22:45 UTC) #5
mmenke
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/02 00:22:45, michaeln wrote: > On 2015/10/01 ...
5 years, 2 months ago (2015-10-02 00:30:05 UTC) #6
michaeln
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/02 00:30:04, mmenke wrote: > On 2015/10/02 ...
5 years, 2 months ago (2015-10-02 01:41:39 UTC) #7
mmenke
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/02 01:41:39, michaeln wrote: > On 2015/10/02 ...
5 years, 2 months ago (2015-10-02 03:12:08 UTC) #8
mmenke
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/02 03:12:08, mmenke wrote: > On 2015/10/02 ...
5 years, 2 months ago (2015-10-02 03:14:14 UTC) #9
mmenke
https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode441 content/browser/service_worker/service_worker_write_to_cache_job.cc:441: NotifyDone(real_status); On 2015/10/02 03:14:14, mmenke wrote: > On 2015/10/02 ...
5 years, 2 months ago (2015-10-02 14:10:44 UTC) #10
Elly Fong-Jones
done, ptal? :) https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/20001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode426 content/browser/service_worker/service_worker_write_to_cache_job.cc:426: // script because the new script ...
5 years, 2 months ago (2015-10-02 14:24:46 UTC) #11
mmenke
LGTM, but do wait for michaeln to sign off as well...This is sufficiently weird that ...
5 years, 2 months ago (2015-10-02 16:10:59 UTC) #12
michaeln
falken really would be the best reviewer for this, he was the primary reviewer for ...
5 years, 2 months ago (2015-10-02 23:54:19 UTC) #15
falken
https://codereview.chromium.org/1375293004/diff/40001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/40001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode438 content/browser/service_worker/service_worker_write_to_cache_job.cc:438: NotifyFinishedCaching(reported_status, reported_status_message); This doesn't look right... in the compare ...
5 years, 2 months ago (2015-10-05 07:03:30 UTC) #16
Elly Fong-Jones
ptal? https://codereview.chromium.org/1375293004/diff/40001/content/browser/service_worker/service_worker_write_to_cache_job.cc File content/browser/service_worker/service_worker_write_to_cache_job.cc (right): https://codereview.chromium.org/1375293004/diff/40001/content/browser/service_worker/service_worker_write_to_cache_job.cc#newcode438 content/browser/service_worker/service_worker_write_to_cache_job.cc:438: NotifyFinishedCaching(reported_status, reported_status_message); On 2015/10/05 07:03:30, falken wrote: > ...
5 years, 2 months ago (2015-10-05 13:50:28 UTC) #17
falken
LGTM
5 years, 2 months ago (2015-10-05 13:55:46 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1375293004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1375293004/60001
5 years, 2 months ago (2015-10-05 13:58:35 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_clobber_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_clobber_rel_ng/builds/78074)
5 years, 2 months ago (2015-10-05 14:07:03 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1375293004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1375293004/60001
5 years, 2 months ago (2015-10-06 13:31:53 UTC) #25
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 2 months ago (2015-10-06 13:50:42 UTC) #26
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/7320022d75696c0f0b4ea02ed801fbbec4783658 Cr-Commit-Position: refs/heads/master@{#352593}
5 years, 2 months ago (2015-10-06 13:51:41 UTC) #27
Elly Fong-Jones
5 years, 2 months ago (2015-10-06 16:37:52 UTC) #28
Message was sent while issue was closed.
A revert of this CL (patchset #4 id:60001) has been created in
https://codereview.chromium.org/1388123002/ by ellyjones@chromium.org.

The reason for reverting is: Broke this blink bot:
http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux/builds/55132.

Powered by Google App Engine
This is Rietveld 408576698