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

Issue 460683002: Change threading in ServiceWorkerCacheStorage (Closed)

Created:
6 years, 4 months ago by jkarlin
Modified:
6 years, 4 months ago
Reviewers:
michaeln, falken, gavinp, kinuko
CC:
chromium-reviews, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, jam, kinuko+serviceworker, nhiroki, darin-cc_chromium.org, horo+watch_chromium.org, alecflett+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Change threading in ServiceWorkerCacheStorage ServiceWorkerCacheStorage currently expects to have its public functions run by a SequencedTaskRunner. This CL changes the functions to run on the calling thread and only uses the TaskRunner for blocking operations. This way, when calling the cache and blob storage, we're on the calling thread (IO). Also added some comments along the way. BUG=392621 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289186

Patch Set 1 #

Patch Set 2 : Proper calls from the manager #

Patch Set 3 : Refactoring #

Patch Set 4 : Lazy init queues requests #

Patch Set 5 : Removed unnecessary change #

Patch Set 6 : More consistent naming #

Patch Set 7 : Fix compile warning #

Patch Set 8 : Fix #

Total comments: 16

Patch Set 9 : Addresses comments from PS8. Extra fixes along the way. #

Patch Set 10 : Reorder members #

Total comments: 4

Patch Set 11 : Remove const ref on weakptrs #

Patch Set 12 : AsWeakPtr #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+567 lines, -178 lines) Patch
M content/browser/service_worker/service_worker_cache.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +10 lines, -3 lines 0 comments Download
M content/browser/service_worker/service_worker_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -5 lines 0 comments Download
M content/browser/service_worker/service_worker_cache_storage.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +61 lines, -19 lines 0 comments Download
M content/browser/service_worker/service_worker_cache_storage.cc View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +479 lines, -122 lines 6 comments Download
M content/browser/service_worker/service_worker_cache_storage_manager.cc View 1 2 7 chunks +8 lines, -29 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
jkarlin
michaeln@chromium.org: Please review changes in everything. Thanks! falken@chromium.org: Please review changes in everything. Thanks! gavinp@chromium.org: ...
6 years, 4 months ago (2014-08-11 18:26:49 UTC) #1
michaeln
i really like this change, overall this more closely matches how threading is handled in ...
6 years, 4 months ago (2014-08-11 19:30:17 UTC) #2
michaeln
> https://codereview.chromium.org/460683002/diff/140001/content/browser/service_worker/service_worker_cache_storage.h#newcode140 > content/browser/service_worker/service_worker_cache_storage.h:140: > base::ThreadChecker thread_checker_; > wdyt of calling this io_thread_checker_ ? it's ...
6 years, 4 months ago (2014-08-11 19:33:39 UTC) #3
michaeln
some more comments inline https://codereview.chromium.org/460683002/diff/140001/content/browser/service_worker/service_worker_cache_storage.cc File content/browser/service_worker/service_worker_cache_storage.cc (right): https://codereview.chromium.org/460683002/diff/140001/content/browser/service_worker/service_worker_cache_storage.cc#newcode151 content/browser/service_worker/service_worker_cache_storage.cc:151: // 1. Delete the cache's ...
6 years, 4 months ago (2014-08-11 20:30:14 UTC) #4
jkarlin
Thanks! Ready for another round. https://codereview.chromium.org/460683002/diff/140001/content/browser/service_worker/service_worker_cache_storage.cc File content/browser/service_worker/service_worker_cache_storage.cc (right): https://codereview.chromium.org/460683002/diff/140001/content/browser/service_worker/service_worker_cache_storage.cc#newcode111 content/browser/service_worker/service_worker_cache_storage.cc:111: base::Unretained(this), // should be ...
6 years, 4 months ago (2014-08-12 14:55:03 UTC) #5
michaeln
lgtm (but please rename the method to obj->GetAsWeakPtr() for consistency with chromium) https://codereview.chromium.org/460683002/diff/180001/content/browser/service_worker/service_worker_cache.h File content/browser/service_worker/service_worker_cache.h ...
6 years, 4 months ago (2014-08-12 23:34:32 UTC) #6
jkarlin
https://codereview.chromium.org/460683002/diff/180001/content/browser/service_worker/service_worker_cache.h File content/browser/service_worker/service_worker_cache.h (right): https://codereview.chromium.org/460683002/diff/180001/content/browser/service_worker/service_worker_cache.h#newcode25 content/browser/service_worker/service_worker_cache.h:25: static scoped_ptr<ServiceWorkerCache> CreateMemoryCache( On 2014/08/12 23:34:32, michaeln wrote: > ...
6 years, 4 months ago (2014-08-12 23:52:55 UTC) #7
jkarlin
The CQ bit was checked by jkarlin@chromium.org
6 years, 4 months ago (2014-08-13 00:36:00 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jkarlin@chromium.org/460683002/210001
6 years, 4 months ago (2014-08-13 00:46:44 UTC) #9
commit-bot: I haz the power
Change committed as 289186
6 years, 4 months ago (2014-08-13 03:33:23 UTC) #10
kinuko
A few drive-by questions, likely just minor ones... https://codereview.chromium.org/460683002/diff/210001/content/browser/service_worker/service_worker_cache_storage.cc File content/browser/service_worker/service_worker_cache_storage.cc (right): https://codereview.chromium.org/460683002/diff/210001/content/browser/service_worker/service_worker_cache_storage.cc#newcode270 content/browser/service_worker/service_worker_cache_storage.cc:270: CacheMap* ...
6 years, 4 months ago (2014-08-23 06:07:44 UTC) #11
jkarlin
6 years, 4 months ago (2014-08-25 18:30:02 UTC) #12
Message was sent while issue was closed.
Thanks Kinuko.  Addressed in https://codereview.chromium.org/503823002

https://codereview.chromium.org/460683002/diff/210001/content/browser/service...
File content/browser/service_worker/service_worker_cache_storage.cc (right):

https://codereview.chromium.org/460683002/diff/210001/content/browser/service...
content/browser/service_worker/service_worker_cache_storage.cc:270: CacheMap*
caches,
On 2014/08/23 06:07:44, kinuko (slow to respond) wrote:
> This is not used and passing the rawptr here feels unsafe?

Done.

https://codereview.chromium.org/460683002/diff/210001/content/browser/service...
content/browser/service_worker/service_worker_cache_storage.cc:643: cache_ptr));
 // cache is owned by this->CacheMap and won't be deleted
On 2014/08/23 06:07:43, kinuko (slow to respond) wrote:
> This comment confused me, since we're passing WeakPtr here contrary to what
the
> comment says. Is it because DeleteCache could come in the mid of WriteIndex,
or
> could there be some other cases? (If the former is the case can you make the
> comment clearer?)

Fixed.  Thanks.

https://codereview.chromium.org/460683002/diff/210001/content/browser/service...
content/browser/service_worker/service_worker_cache_storage.cc:652:
callback.Run(false, CACHE_STORAGE_ERROR_STORAGE);
On 2014/08/23 06:07:43, kinuko (slow to respond) wrote:
> Is returning STORAGE_ERROR expected here?

Done.

Powered by Google App Engine
This is Rietveld 408576698