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

Side by Side Diff: chrome/browser/policy/cloud/remote_commands_invalidator.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: Fix one more compile error. 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/policy/cloud/remote_commands_invalidator.h" 5 #include "chrome/browser/policy/cloud/remote_commands_invalidator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "components/invalidation/invalidation.h" 10 #include "components/invalidation/invalidation.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 invalidation_service_->RegisterInvalidationHandler(this); 131 invalidation_service_->RegisterInvalidationHandler(this);
132 is_registered_ = true; 132 is_registered_ = true;
133 } 133 }
134 134
135 object_id_ = object_id; 135 object_id_ = object_id;
136 UpdateInvalidationsEnabled(); 136 UpdateInvalidationsEnabled();
137 137
138 // Update registration with the invalidation service. 138 // Update registration with the invalidation service.
139 syncer::ObjectIdSet ids; 139 syncer::ObjectIdSet ids;
140 ids.insert(object_id); 140 ids.insert(object_id);
141 invalidation_service_->UpdateRegisteredInvalidationIds(this, ids); 141 CHECK(invalidation_service_->UpdateRegisteredInvalidationIds(this, ids));
bartfab (slow) 2015/05/19 10:44:42 Nit: As in the other file, LOG(ERROR) would be suf
142 } 142 }
143 143
144 void RemoteCommandsInvalidator::Unregister() { 144 void RemoteCommandsInvalidator::Unregister() {
145 if (is_registered_) { 145 if (is_registered_) {
146 invalidation_service_->UpdateRegisteredInvalidationIds( 146 CHECK(invalidation_service_->UpdateRegisteredInvalidationIds(
147 this, syncer::ObjectIdSet()); 147 this, syncer::ObjectIdSet()));
148 invalidation_service_->UnregisterInvalidationHandler(this); 148 invalidation_service_->UnregisterInvalidationHandler(this);
149 is_registered_ = false; 149 is_registered_ = false;
150 UpdateInvalidationsEnabled(); 150 UpdateInvalidationsEnabled();
151 } 151 }
152 } 152 }
153 153
154 void RemoteCommandsInvalidator::UpdateInvalidationsEnabled() { 154 void RemoteCommandsInvalidator::UpdateInvalidationsEnabled() {
155 invalidations_enabled_ = invalidation_service_enabled_ && is_registered_; 155 invalidations_enabled_ = invalidation_service_enabled_ && is_registered_;
156 } 156 }
157 157
158 } // namespace policy 158 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698