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

Side by Side Diff: components/invalidation/invalidation_notifier.cc

Issue 1146533005: [Sync] InvalidationService shouldn't CHECK when registering ObjectId for more than one handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from Bartosz. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/invalidation/invalidation_notifier.h" 5 #include "components/invalidation/invalidation_notifier.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 26 matching lines...) Expand all
37 37
38 InvalidationNotifier::~InvalidationNotifier() { 38 InvalidationNotifier::~InvalidationNotifier() {
39 DCHECK(CalledOnValidThread()); 39 DCHECK(CalledOnValidThread());
40 } 40 }
41 41
42 void InvalidationNotifier::RegisterHandler(InvalidationHandler* handler) { 42 void InvalidationNotifier::RegisterHandler(InvalidationHandler* handler) {
43 DCHECK(CalledOnValidThread()); 43 DCHECK(CalledOnValidThread());
44 registrar_.RegisterHandler(handler); 44 registrar_.RegisterHandler(handler);
45 } 45 }
46 46
47 void InvalidationNotifier::UpdateRegisteredIds(InvalidationHandler* handler, 47 bool InvalidationNotifier::UpdateRegisteredIds(InvalidationHandler* handler,
48 const ObjectIdSet& ids) { 48 const ObjectIdSet& ids) {
49 DCHECK(CalledOnValidThread()); 49 DCHECK(CalledOnValidThread());
50 registrar_.UpdateRegisteredIds(handler, ids); 50 if (!registrar_.UpdateRegisteredIds(handler, ids))
51 return false;
51 invalidation_listener_.UpdateRegisteredIds(registrar_.GetAllRegisteredIds()); 52 invalidation_listener_.UpdateRegisteredIds(registrar_.GetAllRegisteredIds());
53 return true;
52 } 54 }
53 55
54 void InvalidationNotifier::UnregisterHandler(InvalidationHandler* handler) { 56 void InvalidationNotifier::UnregisterHandler(InvalidationHandler* handler) {
55 DCHECK(CalledOnValidThread()); 57 DCHECK(CalledOnValidThread());
56 registrar_.UnregisterHandler(handler); 58 registrar_.UnregisterHandler(handler);
57 } 59 }
58 60
59 InvalidatorState InvalidationNotifier::GetInvalidatorState() const { 61 InvalidatorState InvalidationNotifier::GetInvalidatorState() const {
60 DCHECK(CalledOnValidThread()); 62 DCHECK(CalledOnValidThread());
61 return registrar_.GetInvalidatorState(); 63 return registrar_.GetInvalidatorState();
(...skipping 27 matching lines...) Expand all
89 DCHECK(CalledOnValidThread()); 91 DCHECK(CalledOnValidThread());
90 registrar_.DispatchInvalidationsToHandlers(invalidation_map); 92 registrar_.DispatchInvalidationsToHandlers(invalidation_map);
91 } 93 }
92 94
93 void InvalidationNotifier::OnInvalidatorStateChange(InvalidatorState state) { 95 void InvalidationNotifier::OnInvalidatorStateChange(InvalidatorState state) {
94 DCHECK(CalledOnValidThread()); 96 DCHECK(CalledOnValidThread());
95 registrar_.UpdateInvalidatorState(state); 97 registrar_.UpdateInvalidatorState(state);
96 } 98 }
97 99
98 } // namespace syncer 100 } // namespace syncer
OLDNEW
« no previous file with comments | « components/invalidation/invalidation_notifier.h ('k') | components/invalidation/invalidation_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698