OLD | NEW |
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/sync_invalidation_listener.h" | 5 #include "sync/notifier/sync_invalidation_listener.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 int client_type = ipc::invalidation::ClientType::CHROME_SYNC; | 92 int client_type = ipc::invalidation::ClientType::CHROME_SYNC; |
93 invalidation_client_.reset( | 93 invalidation_client_.reset( |
94 create_invalidation_client_callback.Run( | 94 create_invalidation_client_callback.Run( |
95 &sync_system_resources_, client_type, client_id, | 95 &sync_system_resources_, client_type, client_id, |
96 kApplicationName, this)); | 96 kApplicationName, this)); |
97 invalidation_client_->Start(); | 97 invalidation_client_->Start(); |
98 | 98 |
99 registration_manager_.reset( | 99 registration_manager_.reset( |
100 new RegistrationManager(invalidation_client_.get())); | 100 new RegistrationManager(invalidation_client_.get())); |
101 | 101 |
102 // TODO(rlarocque): This call exists as part of an effort to move the | |
103 // invalidator's ID out of sync. It writes the provided (sync-managed) ID to | |
104 // storage that lives on the UI thread. Once this has been in place for a | |
105 // milestone or two, we can remove it and start looking for invalidator client | |
106 // IDs exclusively in the InvalidationStateTracker. See crbug.com/124142. | |
107 invalidation_state_tracker_.Call( | |
108 FROM_HERE, | |
109 &InvalidationStateTracker::SetInvalidatorClientId, | |
110 client_id); | |
111 | |
112 // Set up reminders for any invalidations that have not been locally | 102 // Set up reminders for any invalidations that have not been locally |
113 // acknowledged. | 103 // acknowledged. |
114 ObjectIdSet unacknowledged_ids; | 104 ObjectIdSet unacknowledged_ids; |
115 for (InvalidationStateMap::const_iterator it = | 105 for (InvalidationStateMap::const_iterator it = |
116 invalidation_state_map_.begin(); | 106 invalidation_state_map_.begin(); |
117 it != invalidation_state_map_.end(); ++it) { | 107 it != invalidation_state_map_.end(); ++it) { |
118 if (it->second.expected.Equals(it->second.current)) | 108 if (it->second.expected.Equals(it->second.current)) |
119 continue; | 109 continue; |
120 unacknowledged_ids.insert(it->first); | 110 unacknowledged_ids.insert(it->first); |
121 } | 111 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 EmitStateChange(); | 445 EmitStateChange(); |
456 } | 446 } |
457 | 447 |
458 void SyncInvalidationListener::OnIncomingNotification( | 448 void SyncInvalidationListener::OnIncomingNotification( |
459 const notifier::Notification& notification) { | 449 const notifier::Notification& notification) { |
460 DCHECK(CalledOnValidThread()); | 450 DCHECK(CalledOnValidThread()); |
461 // Do nothing, since this is already handled by |invalidation_client_|. | 451 // Do nothing, since this is already handled by |invalidation_client_|. |
462 } | 452 } |
463 | 453 |
464 } // namespace syncer | 454 } // namespace syncer |
OLD | NEW |