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

Issue 2973233002: [Background Fetch] Cleanup/fix thread safety (Closed)

Created:
3 years, 5 months ago by johnme
Modified:
3 years, 5 months ago
CC:
chromium-reviews, wjmaclean, awdf+watch_chromium.org, Peter Beverloo, johnme+watch_chromium.org, jam, darin-cc_chromium.org, Dan Elphick
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Background Fetch] Cleanup/fix thread safety Document, cleanup, and in several cases fix thread safety of Background Fetch code. In particular: - BackgroundFetchContext becomes DeleteOnIOThread to simplify shutdown. - BackgroundFetchRequestInfo becomes RefCountedDeleteOnSequence to fix it being deleted on a different thread to the one it is accessed on. - BackgroundFetchRequestInfo::SetDownloadStatePopulated and SetResponseDataPopulated are split out and required to be called on the IO thread, to fix BackgroundFetchJobController writing these fields on the UI thread potentially in parallel with them being read on the IO thread. - Uses WeakPtrs when binding callbacks to BackgroundFetchContext, since those callbacks are sometimes stored by objects that are themselves owned by the context, and so there used to be reference cycles when those callbacks held strong references to the context; this used to cause us to leak the context sometimes. - Adds comments for clarity in tests which use StoragePartition to get a URLRequestContext, but then construct their own BackgroundFetchContext etc instead of using the one owned by the StoragePartition. BUG=none Review-Url: https://codereview.chromium.org/2973233002 Cr-Commit-Position: refs/heads/master@{#485639} Committed: https://chromium.googlesource.com/chromium/src/+/57400c18f9da4828e4b59c33db37cd2b2f52e36f

Patch Set 1 #

Total comments: 12

Patch Set 2 : Address review comments #

Patch Set 3 : Use WeakPtrs when binding BGFContext to avoid reference cycle; also comments for StoragePartition's… #

Patch Set 4 : Remove n.b. from comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -71 lines) Patch
M content/browser/background_fetch/background_fetch_context.h View 1 2 5 chunks +7 lines, -12 lines 0 comments Download
M content/browser/background_fetch/background_fetch_context.cc View 1 2 11 chunks +32 lines, -27 lines 0 comments Download
M content/browser/background_fetch/background_fetch_cross_origin_filter_unittest.cc View 3 chunks +5 lines, -1 line 0 comments Download
M content/browser/background_fetch/background_fetch_data_manager.h View 2 chunks +3 lines, -0 lines 0 comments Download
M content/browser/background_fetch/background_fetch_data_manager.cc View 1 2 3 7 chunks +18 lines, -1 line 0 comments Download
M content/browser/background_fetch/background_fetch_event_dispatcher.cc View 1 1 chunk +7 lines, -2 lines 0 comments Download
M content/browser/background_fetch/background_fetch_job_controller.cc View 5 chunks +30 lines, -8 lines 0 comments Download
M content/browser/background_fetch/background_fetch_job_controller_unittest.cc View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/background_fetch/background_fetch_request_info.h View 4 chunks +15 lines, -6 lines 0 comments Download
M content/browser/background_fetch/background_fetch_request_info.cc View 3 chunks +26 lines, -4 lines 0 comments Download
M content/browser/background_fetch/background_fetch_service_impl.cc View 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/background_fetch/background_fetch_service_unittest.cc View 1 2 3 2 chunks +4 lines, -3 lines 0 comments Download
M content/browser/background_fetch/background_fetch_test_base.h View 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/background_fetch/background_fetch_test_base.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/blob_storage/chrome_blob_storage_context.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/blob_storage/chrome_blob_storage_context.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/storage_partition_impl.cc View 1 2 2 chunks +2 lines, -5 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 30 (19 generated)
johnme
3 years, 5 months ago (2017-07-07 16:08:22 UTC) #2
johnme
3 years, 5 months ago (2017-07-10 12:55:00 UTC) #3
Peter Beverloo
lgtm, but please wait for Dan's review https://codereview.chromium.org/2973233002/diff/1/content/browser/background_fetch/background_fetch_data_manager.cc File content/browser/background_fetch/background_fetch_data_manager.cc (right): https://codereview.chromium.org/2973233002/diff/1/content/browser/background_fetch/background_fetch_data_manager.cc#newcode212 content/browser/background_fetch/background_fetch_data_manager.cc:212: DCHECK_CURRENTLY_ON(BrowserThread::IO); ChromeBlobStorageContext::CreateFileBackedBlob() ...
3 years, 5 months ago (2017-07-10 13:13:22 UTC) #4
Dan Elphick
lgtm
3 years, 5 months ago (2017-07-10 13:26:02 UTC) #6
johnme
Thanks, addressed review comments. https://codereview.chromium.org/2973233002/diff/1/content/browser/background_fetch/background_fetch_data_manager.cc File content/browser/background_fetch/background_fetch_data_manager.cc (right): https://codereview.chromium.org/2973233002/diff/1/content/browser/background_fetch/background_fetch_data_manager.cc#newcode212 content/browser/background_fetch/background_fetch_data_manager.cc:212: DCHECK_CURRENTLY_ON(BrowserThread::IO); On 2017/07/10 13:13:21, Peter ...
3 years, 5 months ago (2017-07-10 13:41:08 UTC) #7
johnme
+avi: Please review content/browser/blob_storage/ and content/browser/storage_partition_impl.cc. Thanks!
3 years, 5 months ago (2017-07-10 17:51:10 UTC) #16
Avi (use Gerrit)
content stuff lgtm stamp
3 years, 5 months ago (2017-07-10 18:07:11 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2973233002/60001
3 years, 5 months ago (2017-07-11 11:39:19 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/425006)
3 years, 5 months ago (2017-07-11 12:50:40 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2973233002/60001
3 years, 5 months ago (2017-07-11 15:09:12 UTC) #27
commit-bot: I haz the power
3 years, 5 months ago (2017-07-11 15:56:54 UTC) #30
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/57400c18f9da4828e4b59c33db37...

Powered by Google App Engine
This is Rietveld 408576698