| 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/registration_manager.h" | 5 #include "sync/notifier/registration_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 invalidation::InvalidationClient* invalidation_client) | 59 invalidation::InvalidationClient* invalidation_client) |
| 60 : invalidation_client_(invalidation_client) { | 60 : invalidation_client_(invalidation_client) { |
| 61 DCHECK(invalidation_client_); | 61 DCHECK(invalidation_client_); |
| 62 } | 62 } |
| 63 | 63 |
| 64 RegistrationManager::~RegistrationManager() { | 64 RegistrationManager::~RegistrationManager() { |
| 65 DCHECK(CalledOnValidThread()); | 65 DCHECK(CalledOnValidThread()); |
| 66 STLDeleteValues(®istration_statuses_); | 66 STLDeleteValues(®istration_statuses_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void RegistrationManager::SetRegisteredIds(const ObjectIdSet& ids) { | 69 void RegistrationManager::UpdateRegisteredIds(const ObjectIdSet& ids) { |
| 70 DCHECK(CalledOnValidThread()); | 70 DCHECK(CalledOnValidThread()); |
| 71 | 71 |
| 72 const ObjectIdSet& old_ids = GetRegisteredIds(); | 72 const ObjectIdSet& old_ids = GetRegisteredIds(); |
| 73 const ObjectIdSet& to_register = ids; | 73 const ObjectIdSet& to_register = ids; |
| 74 ObjectIdSet to_unregister; | 74 ObjectIdSet to_unregister; |
| 75 std::set_difference(old_ids.begin(), old_ids.end(), | 75 std::set_difference(old_ids.begin(), old_ids.end(), |
| 76 ids.begin(), ids.end(), | 76 ids.begin(), ids.end(), |
| 77 std::inserter(to_unregister, to_unregister.begin()), | 77 std::inserter(to_unregister, to_unregister.begin()), |
| 78 ObjectIdLessThan()); | 78 ObjectIdLessThan()); |
| 79 | 79 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 bool RegistrationManager::IsIdRegistered( | 294 bool RegistrationManager::IsIdRegistered( |
| 295 const invalidation::ObjectId& id) const { | 295 const invalidation::ObjectId& id) const { |
| 296 DCHECK(CalledOnValidThread()); | 296 DCHECK(CalledOnValidThread()); |
| 297 RegistrationStatusMap::const_iterator it = | 297 RegistrationStatusMap::const_iterator it = |
| 298 registration_statuses_.find(id); | 298 registration_statuses_.find(id); |
| 299 return it != registration_statuses_.end() && | 299 return it != registration_statuses_.end() && |
| 300 it->second->state == invalidation::InvalidationListener::REGISTERED; | 300 it->second->state == invalidation::InvalidationListener::REGISTERED; |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace syncer | 303 } // namespace syncer |
| OLD | NEW |