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

Issue 272323002: sync: Implement disabling of non blocking types (Closed)

Created:
6 years, 7 months ago by rlarocque
Modified:
6 years, 7 months ago
Reviewers:
Nicolas Zea
CC:
chromium-reviews, tim+watch_chromium.org, haitaol+watch_chromium.org, maniscalco+watch_chromium.org
Visibility:
Public.

Description

sync: Implement disabling of non blocking types Adds logic to have the model-thread NonBlockingDataTypeProcessor send a message to the sync-thread SyncCore when it receives notifcation from the ui-thread NonBlockingDataTypeController that it should stop syncing. This message will allow the sync thread to stop requeting updates and commits on behalf of the now-disabled type. Fixes the handling of a race in the NonBlockingDataTypeProcessor. The race is as follows: 1. NBDTP receives a request to enable sync from the UI thread, and sends a connection request to the sync thread via SyncCoreProxy. 2. NBDTP receives a request to disable sync from the UI thread. It updates its internal state accordingly. 3. NBDTP receives the connection OK response from the sync thread, which was genrated in response to its request in step 1. Previously, the processor would wrongly set itself to the enable state in step 3. The fix is to use a new WeakPtrFactory and invalidate the pointers it has issued in step 2 in order to prevent the response seen in step 3 from being run. Adds some more tests for this scenario and more. The test framework had to be made a bit more complicated in order to handle these tests, but I think the extra complexity is worth it. I don't know of any other way to reliably defend against these race cases. BUG=351005 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=269916

Patch Set 1 #

Total comments: 8

Patch Set 2 : Review fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+283 lines, -53 lines) Patch
M components/sync_driver/non_blocking_data_type_controller.cc View 1 chunk +4 lines, -5 lines 0 comments Download
M components/sync_driver/non_blocking_data_type_controller_unittest.cc View 1 4 chunks +198 lines, -16 lines 0 comments Download
M sync/internal_api/non_blocking_type_processor.cc View 3 chunks +24 lines, -8 lines 0 comments Download
M sync/internal_api/public/non_blocking_type_processor.h View 1 3 chunks +15 lines, -3 lines 0 comments Download
M sync/internal_api/public/sync_core_proxy.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
M sync/internal_api/public/test/null_sync_core_proxy.h View 1 chunk +1 line, -0 lines 0 comments Download
M sync/internal_api/sync_core.h View 1 1 chunk +11 lines, -0 lines 0 comments Download
M sync/internal_api/sync_core.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M sync/internal_api/sync_core_proxy_impl.h View 1 chunk +3 lines, -0 lines 0 comments Download
M sync/internal_api/sync_core_proxy_impl.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M sync/internal_api/sync_core_proxy_impl_unittest.cc View 1 chunk +1 line, -3 lines 0 comments Download
M sync/internal_api/test/null_sync_core_proxy.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M sync/sessions/model_type_registry_unittest.cc View 4 chunks +6 lines, -18 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
rlarocque
Hi Nicolas, A few days ago, you made a comment that made me wonder if ...
6 years, 7 months ago (2014-05-12 18:33:20 UTC) #1
Nicolas Zea
LGTM with nits https://codereview.chromium.org/272323002/diff/1/components/sync_driver/non_blocking_data_type_controller_unittest.cc File components/sync_driver/non_blocking_data_type_controller_unittest.cc (right): https://codereview.chromium.org/272323002/diff/1/components/sync_driver/non_blocking_data_type_controller_unittest.cc#newcode25 components/sync_driver/non_blocking_data_type_controller_unittest.cc:25: scoped_refptr<base::SingleThreadTaskRunner> model_task_runner, nit: passed scoped_refptrs and ...
6 years, 7 months ago (2014-05-12 19:09:09 UTC) #2
rlarocque
https://codereview.chromium.org/272323002/diff/1/components/sync_driver/non_blocking_data_type_controller_unittest.cc File components/sync_driver/non_blocking_data_type_controller_unittest.cc (right): https://codereview.chromium.org/272323002/diff/1/components/sync_driver/non_blocking_data_type_controller_unittest.cc#newcode25 components/sync_driver/non_blocking_data_type_controller_unittest.cc:25: scoped_refptr<base::SingleThreadTaskRunner> model_task_runner, On 2014/05/12 19:09:10, Nicolas Zea wrote: > ...
6 years, 7 months ago (2014-05-12 20:02:13 UTC) #3
rlarocque
The CQ bit was checked by rlarocque@chromium.org
6 years, 7 months ago (2014-05-12 20:02:21 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/272323002/20001
6 years, 7 months ago (2014-05-12 20:02:51 UTC) #5
commit-bot: I haz the power
6 years, 7 months ago (2014-05-12 23:46:27 UTC) #6
Message was sent while issue was closed.
Change committed as 269916

Powered by Google App Engine
This is Rietveld 408576698