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

Side by Side Diff: sync/notifier/invalidation_notifier.cc

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "sync/notifier/invalidation_notifier.h" 5 #include "sync/notifier/invalidation_notifier.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "jingle/notifier/listener/push_client.h" 10 #include "jingle/notifier/listener/push_client.h"
(...skipping 16 matching lines...) Expand all
27 invalidation_state_tracker_(invalidation_state_tracker), 27 invalidation_state_tracker_(invalidation_state_tracker),
28 client_info_(client_info), 28 client_info_(client_info),
29 invalidation_state_(initial_invalidation_state), 29 invalidation_state_(initial_invalidation_state),
30 invalidation_client_(push_client.Pass()) { 30 invalidation_client_(push_client.Pass()) {
31 } 31 }
32 32
33 InvalidationNotifier::~InvalidationNotifier() { 33 InvalidationNotifier::~InvalidationNotifier() {
34 DCHECK(CalledOnValidThread()); 34 DCHECK(CalledOnValidThread());
35 } 35 }
36 36
37 void InvalidationNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler, 37 void InvalidationNotifier::SetHandler(const std::string& handler_name,
38 const ObjectIdSet& ids) { 38 SyncNotifierObserver* handler) {
39 DCHECK(CalledOnValidThread()); 39 DCHECK(CalledOnValidThread());
40 invalidation_client_.RegisterIds(helper_.UpdateRegisteredIds(handler, ids)); 40 helper_.SetHandler(handler_name, handler);
41 }
42
43 void InvalidationNotifier::UpdateRegisteredIds(
44 const std::string& handler_name,
45 const ObjectIdSet& ids) {
46 DCHECK(CalledOnValidThread());
47 helper_.UpdateRegisteredIds(handler_name, ids);
48 const ObjectIdSet& all_registered_ids = helper_.GetAllRegisteredIds();
msw 2012/08/07 20:09:30 nit: comment explaining when |ids| won't match |a
akalin 2012/08/07 23:38:05 ids is only for |handler_name|/|handler|, but all_
msw 2012/08/08 00:55:23 Ok, I was simply confused. I think it's odd that t
49 invalidation_client_.RegisterIds(all_registered_ids);
41 } 50 }
42 51
43 void InvalidationNotifier::SetUniqueId(const std::string& unique_id) { 52 void InvalidationNotifier::SetUniqueId(const std::string& unique_id) {
44 DCHECK(CalledOnValidThread()); 53 DCHECK(CalledOnValidThread());
45 invalidation_client_id_ = unique_id; 54 invalidation_client_id_ = unique_id;
46 DVLOG(1) << "Setting unique ID to " << unique_id; 55 DVLOG(1) << "Setting unique ID to " << unique_id;
47 CHECK(!invalidation_client_id_.empty()); 56 CHECK(!invalidation_client_id_.empty());
48 } 57 }
49 58
50 void InvalidationNotifier::SetStateDeprecated(const std::string& state) { 59 void InvalidationNotifier::SetStateDeprecated(const std::string& state) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 helper_.EmitOnNotificationsEnabled(); 105 helper_.EmitOnNotificationsEnabled();
97 } 106 }
98 107
99 void InvalidationNotifier::OnNotificationsDisabled( 108 void InvalidationNotifier::OnNotificationsDisabled(
100 NotificationsDisabledReason reason) { 109 NotificationsDisabledReason reason) {
101 DCHECK(CalledOnValidThread()); 110 DCHECK(CalledOnValidThread());
102 helper_.EmitOnNotificationsDisabled(reason); 111 helper_.EmitOnNotificationsDisabled(reason);
103 } 112 }
104 113
105 } // namespace syncer 114 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698