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

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed)

Created:
8 years, 4 months ago by akalin
Modified:
8 years, 4 months ago
CC:
chromium-reviews, Raghu Simha, ncarter (slow), tim (not reviewing)
Visibility:
Public.

Description

[Sync] Avoid unregistering object IDs on shutdown Add RegisterHandler() and UnregisterHandler(), which should be called before and after calls to UpdateRegisteredIds(). Use UnregisterHandler() on shutdown instead of UpdateRegisteredIds(_, ObjectIdSet()). Make SyncNotifierHelper non-thread-safe. Fix test breakages that this revealed. Also add GetAllRegisteredIds() instead of making it the return value of UpdateRegisteredIds(). Propagate UpdateRegisteredIds()/RegisterHandler()/UnregisterHandler() all the way up to ProfileSyncService. Make FakeSyncManager be created on the sync thread. Clean up SyncBackendHost startup/shutdown behavior a bit. BUG=140325 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=150990 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=151107

Patch Set 1 #

Patch Set 2 : add todo #

Patch Set 3 : Remove now-unneeded param #

Total comments: 2

Patch Set 4 : Fix compile, address comments #

Total comments: 4

Patch Set 5 : Address comments #

Total comments: 92

Patch Set 6 : Address comments #

Patch Set 7 : Address a couple of spots i missed #

Total comments: 6

Patch Set 8 : Address comments #

Total comments: 32

Patch Set 9 : Address non-API comments #

Patch Set 10 : Use new API #

Total comments: 33

Patch Set 11 : Sync to head, address comments #

Patch Set 12 : Few more minor fixes #

Patch Set 13 : Work around brittle unit test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1072 lines, -514 lines) Patch
M chrome/browser/sync/glue/bridged_sync_notifier.h View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/bridged_sync_notifier.cc View 1 2 3 4 5 6 7 8 9 1 chunk +15 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +29 lines, -9 lines 0 comments Download
M chrome/browser/sync/glue/chrome_sync_notification_bridge.h View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/browser/sync/glue/chrome_sync_notification_bridge.cc View 1 2 3 4 5 6 7 8 9 9 chunks +62 lines, -8 lines 0 comments Download
M chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.h View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.cc View 1 2 3 4 5 6 7 8 9 10 12 chunks +58 lines, -28 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host_unittest.cc View 1 2 3 4 5 6 7 8 10 chunks +80 lines, -26 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +48 lines, -10 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.cc View 1 2 3 4 5 6 7 8 9 4 chunks +19 lines, -7 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -2 lines 0 comments Download
M sync/internal_api/public/sync_manager.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +9 lines, -2 lines 0 comments Download
M sync/internal_api/public/test/fake_sync_manager.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +24 lines, -19 lines 0 comments Download
M sync/internal_api/sync_manager_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -0 lines 0 comments Download
M sync/internal_api/sync_manager_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +25 lines, -5 lines 0 comments Download
M sync/internal_api/sync_manager_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +19 lines, -2 lines 0 comments Download
M sync/internal_api/test/fake_sync_manager.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +39 lines, -17 lines 0 comments Download
M sync/notifier/invalidation_notifier.h View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -2 lines 0 comments Download
M sync/notifier/invalidation_notifier.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +15 lines, -6 lines 0 comments Download
M sync/notifier/invalidation_notifier_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +13 lines, -12 lines 0 comments Download
M sync/notifier/non_blocking_invalidation_notifier.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +6 lines, -2 lines 0 comments Download
M sync/notifier/non_blocking_invalidation_notifier.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +23 lines, -9 lines 0 comments Download
M sync/notifier/non_blocking_invalidation_notifier_unittest.cc View 1 2 3 4 5 6 7 8 9 3 chunks +8 lines, -5 lines 0 comments Download
M sync/notifier/p2p_notifier.h View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -2 lines 0 comments Download
M sync/notifier/p2p_notifier.cc View 1 2 3 4 5 6 7 8 9 5 chunks +18 lines, -5 lines 0 comments Download
M sync/notifier/p2p_notifier_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +15 lines, -14 lines 0 comments Download
M sync/notifier/sync_notifier.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +37 lines, -3 lines 0 comments Download
M sync/notifier/sync_notifier_factory_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -2 lines 0 comments Download
M sync/notifier/sync_notifier_helper.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -55 lines 0 comments Download
M sync/notifier/sync_notifier_helper.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -95 lines 0 comments Download
M sync/notifier/sync_notifier_helper_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -156 lines 0 comments Download
A sync/notifier/sync_notifier_registrar.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +82 lines, -0 lines 0 comments Download
A sync/notifier/sync_notifier_registrar.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +129 lines, -0 lines 0 comments Download
A sync/notifier/sync_notifier_registrar_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +248 lines, -0 lines 0 comments Download
M sync/sync.gyp View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -3 lines 0 comments Download
M sync/tools/sync_listen_notifications.cc View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 31 (0 generated)
akalin
+dcheng for sync/notifier stuff. +tim for everything else. +msw FYI.
8 years, 4 months ago (2012-08-03 04:52:03 UTC) #1
dcheng
https://chromiumcodereview.appspot.com/10824161/diff/4002/sync/notifier/sync_notifier_helper.cc File sync/notifier/sync_notifier_helper.cc (right): https://chromiumcodereview.appspot.com/10824161/diff/4002/sync/notifier/sync_notifier_helper.cc#newcode32 sync/notifier/sync_notifier_helper.cc:32: handlers_.RemoveObserver(old_handler); I don't think you need this line, since ...
8 years, 4 months ago (2012-08-03 06:05:29 UTC) #2
akalin
PTAL http://codereview.chromium.org/10824161/diff/4002/sync/notifier/sync_notifier_helper.cc File sync/notifier/sync_notifier_helper.cc (right): http://codereview.chromium.org/10824161/diff/4002/sync/notifier/sync_notifier_helper.cc#newcode32 sync/notifier/sync_notifier_helper.cc:32: handlers_.RemoveObserver(old_handler); On 2012/08/03 06:05:30, dcheng wrote: > I ...
8 years, 4 months ago (2012-08-03 18:44:10 UTC) #3
dcheng
LGTM. Some super minor comments. http://codereview.chromium.org/10824161/diff/6005/sync/notifier/sync_notifier_helper.cc File sync/notifier/sync_notifier_helper.cc (right): http://codereview.chromium.org/10824161/diff/6005/sync/notifier/sync_notifier_helper.cc#newcode31 sync/notifier/sync_notifier_helper.cc:31: name_to_handler_map_[handler_name] = handler; Nit: ...
8 years, 4 months ago (2012-08-03 20:34:14 UTC) #4
akalin
Tim? http://codereview.chromium.org/10824161/diff/6005/sync/notifier/sync_notifier_helper.cc File sync/notifier/sync_notifier_helper.cc (right): http://codereview.chromium.org/10824161/diff/6005/sync/notifier/sync_notifier_helper.cc#newcode31 sync/notifier/sync_notifier_helper.cc:31: name_to_handler_map_[handler_name] = handler; On 2012/08/03 20:34:14, dcheng wrote: ...
8 years, 4 months ago (2012-08-03 20:48:39 UTC) #5
msw
Lots of line-break and one-param-per-line nits, etc. (sorry if some are duplicated with the other ...
8 years, 4 months ago (2012-08-03 23:30:46 UTC) #6
akalin
On 2012/08/03 23:30:46, msw wrote: > Lots of line-break and one-param-per-line nits, etc. (sorry if ...
8 years, 4 months ago (2012-08-04 00:03:41 UTC) #7
msw
On 2012/08/04 00:03:41, akalin wrote: > On 2012/08/03 23:30:46, msw wrote: > > Lots of ...
8 years, 4 months ago (2012-08-04 00:42:33 UTC) #8
tim (not reviewing)
http://codereview.chromium.org/10824161/diff/1034/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc File chrome/browser/sync/glue/chrome_sync_notification_bridge.cc (right): http://codereview.chromium.org/10824161/diff/1034/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc#newcode31 chrome/browser/sync/glue/chrome_sync_notification_bridge.cc:31: void DestroyOnSyncThread(); Is 'Destroy' the right name? This won't ...
8 years, 4 months ago (2012-08-06 05:55:32 UTC) #9
akalin
Addressed all comments. PTAL. http://codereview.chromium.org/10824161/diff/1034/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc File chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc (right): http://codereview.chromium.org/10824161/diff/1034/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc#newcode61 chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc:61: // All tests just verify ...
8 years, 4 months ago (2012-08-07 07:25:19 UTC) #10
tim (not reviewing)
http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host.cc File chrome/browser/sync/glue/sync_backend_host.cc (right): http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host.cc#newcode580 chrome/browser/sync/glue/sync_backend_host.cc:580: DCHECK_EQ(initialization_state_, NOT_ATTEMPTED); hm, so I've always followed the pattern ...
8 years, 4 months ago (2012-08-07 16:39:38 UTC) #11
akalin
http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host.cc File chrome/browser/sync/glue/sync_backend_host.cc (right): http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host.cc#newcode580 chrome/browser/sync/glue/sync_backend_host.cc:580: DCHECK_EQ(initialization_state_, NOT_ATTEMPTED); On 2012/08/07 16:39:38, timsteele wrote: > hm, ...
8 years, 4 months ago (2012-08-07 17:19:23 UTC) #12
tim (not reviewing)
LGTM http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host_unittest.cc File chrome/browser/sync/glue/sync_backend_host_unittest.cc (right): http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host_unittest.cc#newcode661 chrome/browser/sync/glue/sync_backend_host_unittest.cc:661: SetUp(); On 2012/08/07 17:19:23, akalin wrote: > On ...
8 years, 4 months ago (2012-08-07 17:22:12 UTC) #13
akalin
msw? http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host_unittest.cc File chrome/browser/sync/glue/sync_backend_host_unittest.cc (right): http://codereview.chromium.org/10824161/diff/1038/chrome/browser/sync/glue/sync_backend_host_unittest.cc#newcode661 chrome/browser/sync/glue/sync_backend_host_unittest.cc:661: SetUp(); On 2012/08/07 17:22:12, timsteele wrote: > On ...
8 years, 4 months ago (2012-08-07 18:11:29 UTC) #14
msw
You all know this code a lot better than I do, so feel free to ...
8 years, 4 months ago (2012-08-07 20:09:30 UTC) #15
akalin
On 2012/08/07 20:09:30, msw wrote: > http://codereview.chromium.org/10824161/diff/11011/chrome/browser/sync/glue/bridged_sync_notifier.h#newcode32 > chrome/browser/sync/glue/bridged_sync_notifier.h:32: virtual void > SetHandler(const std::string& handler_name, ...
8 years, 4 months ago (2012-08-07 21:14:04 UTC) #16
akalin
As discussed, I'll implement the following API: void AddHandler(SyncNotifierObserver* handler) void UpdateRegisteredIds(SyncNotifierObserver* handler, set<ObjectId>) void ...
8 years, 4 months ago (2012-08-07 22:27:56 UTC) #17
akalin
Addressed non-API comments, some with replies and additional questions. msw@, PTAL at my replies. http://codereview.chromium.org/10824161/diff/11011/chrome/browser/sync/glue/chrome_sync_notification_bridge.cc ...
8 years, 4 months ago (2012-08-07 23:38:05 UTC) #18
msw
Looking forward to the revised API :) http://codereview.chromium.org/10824161/diff/11011/chrome/browser/sync/glue/sync_backend_host_unittest.cc File chrome/browser/sync/glue/sync_backend_host_unittest.cc (right): http://codereview.chromium.org/10824161/diff/11011/chrome/browser/sync/glue/sync_backend_host_unittest.cc#newcode647 chrome/browser/sync/glue/sync_backend_host_unittest.cc:647: // Should ...
8 years, 4 months ago (2012-08-08 00:55:23 UTC) #19
akalin
New patchset with new API! Everyone should probably take another look, since stuff has changed ...
8 years, 4 months ago (2012-08-08 22:32:22 UTC) #20
msw
LGTM with nits; thanks! http://codereview.chromium.org/10824161/diff/12014/chrome/browser/sync/profile_sync_service.h File chrome/browser/sync/profile_sync_service.h (right): http://codereview.chromium.org/10824161/diff/12014/chrome/browser/sync/profile_sync_service.h#newcode555 chrome/browser/sync/profile_sync_service.h:555: // Invalidation clients should follow ...
8 years, 4 months ago (2012-08-09 05:20:26 UTC) #21
dcheng
I like the new name for SyncNotifierHelper a lot better. One comment: Once a handler ...
8 years, 4 months ago (2012-08-09 20:53:56 UTC) #22
akalin
Addressed all comments http://codereview.chromium.org/10824161/diff/12014/chrome/browser/sync/profile_sync_service.h File chrome/browser/sync/profile_sync_service.h (right): http://codereview.chromium.org/10824161/diff/12014/chrome/browser/sync/profile_sync_service.h#newcode578 chrome/browser/sync/profile_sync_service.h:578: // pss->UnregisterInvalidationHandler(client_handler) On 2012/08/09 05:20:26, msw ...
8 years, 4 months ago (2012-08-10 01:28:08 UTC) #23
akalin
> One comment: > Once a handler calls SyncNotifierRegistrar::UnregisterHandler, all those IDs are > essentially ...
8 years, 4 months ago (2012-08-10 01:28:55 UTC) #24
akalin
I'm going to assume dcheng's and tim's LGTM still stands unless I hear otherwise before ...
8 years, 4 months ago (2012-08-10 01:29:35 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/akalin@chromium.org/10824161/16050
8 years, 4 months ago (2012-08-10 02:58:23 UTC) #26
commit-bot: I haz the power
Change committed as 150990
8 years, 4 months ago (2012-08-10 04:07:21 UTC) #27
akalin
sigh, looks like it made linux tests fail
8 years, 4 months ago (2012-08-10 04:47:35 UTC) #28
msw
Might it help to split the API change from the titular behavior change that removes ...
8 years, 4 months ago (2012-08-10 06:46:36 UTC) #29
akalin
On 2012/08/10 06:46:36, msw wrote: > Might it help to split the API change from ...
8 years, 4 months ago (2012-08-10 19:01:47 UTC) #30
akalin
8 years, 4 months ago (2012-08-10 20:22:57 UTC) #31
On 2012/08/10 19:01:47, akalin wrote:
> On 2012/08/10 06:46:36, msw wrote:
> > Might it help to split the API change from the titular behavior change that
> > removes calls to notifier->UpdateRegisteredIds(client_handler,
ObjectIdSet());
> > on shutdown?
> 
> No need, the fix for the test is pretty simple.
> 
> Tim, you said you were going to take another look?

Looks like this is sticking.  Yay!

Powered by Google App Engine
This is Rietveld 408576698