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

Issue 2769113002: [Sync] Stop accessing BrowserContextKeyedServiceFactory on non-UI thread. (Closed)

Created:
3 years, 9 months ago by skym
Modified:
3 years, 8 months ago
Reviewers:
Mathieu, vasilii, Devlin, pavely
CC:
chromium-reviews, extensions-reviews_chromium.org, rouslan+autofill_chromium.org, rogerm+autofillwatch_chromium.org, sebsg+autofillwatch_chromium.org, browser-components-watch_chromium.org, mathp+autofillwatch_chromium.org, estade+watch_chromium.org, vabr+watchlistautofill_chromium.org, chromium-apps-reviews_chromium.org, sync-reviews_chromium.org, sense (YandexTeam)
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Sync] Stop accessing BrowserContextKeyedServiceFactory on non-UI thread. In the past the AsyncDirectoryTypeController was passing a raw pointer to a ChromeSyncClient to the model thread, where it had GetSyncableServiceForType called on it. This was needed for several model types, which has specific logic around only accessing their SyncableService on their model threads. However, this was also bad, as BrowserContextKeyedServiceFactorys were being used with a Profile object on a non-UI thread, which is against the rules. To fix this, GetSyncableServiceForType returns a callback which should only be run on the model thread, that will return the same WeakPtr<SyncableService> that we were used to. The various non-UI thread model types do slightly different things as each type has different rules and threading guarantees. The most involved model type in this CL was extensions, which did not have sufficient threading constraints to ensure safety. Added weak pointer support to SyncValueStoreCache to fix this. BUG=701326 Review-Url: https://codereview.chromium.org/2769113002 Cr-Commit-Position: refs/heads/master@{#460304} Committed: https://chromium.googlesource.com/chromium/src/+/cd6b31d4b9613087e1a68c620af83b6fe1892bdf

Patch Set 1 #

Patch Set 2 : Self review. #

Patch Set 3 : Fix some compile issues. #

Patch Set 4 : Small iOS fix. #

Patch Set 5 : Rebase #

Total comments: 12

Patch Set 6 : Updates for Pavel. #

Total comments: 5

Patch Set 7 : Added DCEHCK on FILE back to settings_sync_util #

Patch Set 8 : Rebase and removing dependent patch set. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+338 lines, -235 lines) Patch
M chrome/browser/extensions/api/storage/settings_apitest.cc View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/storage/settings_sync_util.h View 3 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/storage/settings_sync_util.cc View 1 2 3 4 5 6 5 chunks +33 lines, -23 lines 0 comments Download
M chrome/browser/extensions/api/storage/sync_value_store_cache.h View 3 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/storage/sync_value_store_cache.cc View 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/sync/chrome_sync_client.h View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/sync/chrome_sync_client.cc View 1 2 3 4 5 6 7 6 chunks +130 lines, -85 lines 0 comments Download
M components/autofill/core/browser/webdata/autofill_profile_data_type_controller.h View 1 chunk +0 lines, -3 lines 0 comments Download
M components/autofill/core/browser/webdata/autofill_profile_data_type_controller.cc View 1 chunk +0 lines, -1 line 0 comments Download
M components/browser_sync/profile_sync_test_util.cc View 3 chunks +6 lines, -5 lines 0 comments Download
M components/search_engines/search_engine_data_type_controller_unittest.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M components/sync/driver/async_directory_type_controller.cc View 1 chunk +7 lines, -2 lines 0 comments Download
M components/sync/driver/async_directory_type_controller_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M components/sync/driver/directory_data_type_controller.h View 1 chunk +1 line, -0 lines 0 comments Download
M components/sync/driver/directory_data_type_controller.cc View 2 chunks +2 lines, -0 lines 0 comments Download
M components/sync/driver/fake_generic_change_processor.h View 2 chunks +2 lines, -2 lines 0 comments Download
M components/sync/driver/fake_generic_change_processor.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M components/sync/driver/fake_sync_client.h View 1 chunk +1 line, -2 lines 0 comments Download
M components/sync/driver/fake_sync_client.cc View 2 chunks +9 lines, -3 lines 0 comments Download
M components/sync/driver/generic_change_processor.h View 2 chunks +2 lines, -2 lines 0 comments Download
M components/sync/driver/generic_change_processor.cc View 3 chunks +3 lines, -6 lines 0 comments Download
M components/sync/driver/generic_change_processor_factory.h View 2 chunks +2 lines, -2 lines 0 comments Download
M components/sync/driver/generic_change_processor_factory.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M components/sync/driver/generic_change_processor_unittest.cc View 1 3 chunks +2 lines, -4 lines 0 comments Download
M components/sync/driver/shared_change_processor.h View 4 chunks +8 lines, -5 lines 0 comments Download
M components/sync/driver/shared_change_processor.cc View 1 2 3 4 5 4 chunks +13 lines, -13 lines 0 comments Download
M components/sync/driver/shared_change_processor_unittest.cc View 2 chunks +5 lines, -4 lines 0 comments Download
M components/sync/driver/sync_client.h View 1 2 3 4 5 2 chunks +6 lines, -5 lines 0 comments Download
M ios/chrome/browser/sync/ios_chrome_sync_client.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M ios/chrome/browser/sync/ios_chrome_sync_client.mm View 1 2 3 4 2 chunks +73 lines, -44 lines 0 comments Download

Messages

Total messages: 48 (33 generated)
skym
PTAL
3 years, 9 months ago (2017-03-23 05:42:49 UTC) #5
skym
Some updates to fix compile issues. iOS is likely still broken.
3 years, 9 months ago (2017-03-23 06:14:14 UTC) #10
skym
Okay, iOS is fixed, PLTA Pavel.
3 years, 9 months ago (2017-03-24 15:55:41 UTC) #19
pavely
lgtm % comment about comment in chrome_sync_client.cc https://codereview.chromium.org/2769113002/diff/80001/chrome/browser/extensions/api/storage/settings_sync_util.cc File chrome/browser/extensions/api/storage/settings_sync_util.cc (right): https://codereview.chromium.org/2769113002/diff/80001/chrome/browser/extensions/api/storage/settings_sync_util.cc#newcode53 chrome/browser/extensions/api/storage/settings_sync_util.cc:53: // WeakPtr ...
3 years, 8 months ago (2017-03-27 19:38:26 UTC) #22
skym
Updates for Pavel. Adding OWNERs for specific model types, PTAL. rdevlin.cronin@ - chrome/browser/extensions/api/storage/* mathp@ - ...
3 years, 8 months ago (2017-03-27 21:45:26 UTC) #24
Devlin
https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h File chrome/browser/extensions/api/storage/settings_sync_util.h (right): https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h#newcode55 chrome/browser/extensions/api/storage/settings_sync_util.h:55: syncer::SyncClient::ServiceProvider GetSyncableServiceProvider( I'm a little nervous about this - ...
3 years, 8 months ago (2017-03-27 21:54:23 UTC) #27
skym
https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h File chrome/browser/extensions/api/storage/settings_sync_util.h (right): https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h#newcode55 chrome/browser/extensions/api/storage/settings_sync_util.h:55: syncer::SyncClient::ServiceProvider GetSyncableServiceProvider( On 2017/03/27 21:54:23, Devlin wrote: > I'm ...
3 years, 8 months ago (2017-03-27 22:38:47 UTC) #29
Mathieu
autofill lgtm
3 years, 8 months ago (2017-03-27 23:36:23 UTC) #33
Devlin
https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h File chrome/browser/extensions/api/storage/settings_sync_util.h (right): https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h#newcode55 chrome/browser/extensions/api/storage/settings_sync_util.h:55: syncer::SyncClient::ServiceProvider GetSyncableServiceProvider( On 2017/03/27 22:38:47, skym wrote: > On ...
3 years, 8 months ago (2017-03-28 01:17:24 UTC) #34
skym
https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h File chrome/browser/extensions/api/storage/settings_sync_util.h (right): https://codereview.chromium.org/2769113002/diff/100001/chrome/browser/extensions/api/storage/settings_sync_util.h#newcode55 chrome/browser/extensions/api/storage/settings_sync_util.h:55: syncer::SyncClient::ServiceProvider GetSyncableServiceProvider( On 2017/03/28 01:17:23, Devlin wrote: > On ...
3 years, 8 months ago (2017-03-28 05:01:20 UTC) #35
vasilii
lgtm components/search_engines/search_engine_data_type_controller_unittest.cc
3 years, 8 months ago (2017-03-28 09:38:14 UTC) #36
Devlin
extensions lgtm. I think I've convinced myself this is safe. Ideally, we'd clean up the ...
3 years, 8 months ago (2017-03-29 01:47:40 UTC) #41
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/2769113002/140001
3 years, 8 months ago (2017-03-29 05:59:17 UTC) #44
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://chromium.googlesource.com/chromium/src/+/cd6b31d4b9613087e1a68c620af83b6fe1892bdf
3 years, 8 months ago (2017-03-29 06:47:55 UTC) #47
skym
3 years, 8 months ago (2017-04-06 17:08:43 UTC) #48
Message was sent while issue was closed.
A revert of this CL (patchset #8 id:140001) has been created in
https://codereview.chromium.org/2799653006/ by skym@chromium.org.

The reason for reverting is: Caused a memory regression, see crbug.com/708666 ,
unclear to me why exactly this is. Progress investigating the memory regression
seems tricky so far, so reverting to fix more quickly..

Powered by Google App Engine
This is Rietveld 408576698