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

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

Issue 10827133: [Sync] Rework unit tests for ChromeInvalidationClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head 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
« no previous file with comments | « sync/notifier/registration_manager.h ('k') | sync/notifier/registration_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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(&registration_statuses_); 66 STLDeleteValues(&registration_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
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
OLDNEW
« no previous file with comments | « sync/notifier/registration_manager.h ('k') | sync/notifier/registration_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698