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

Side by Side Diff: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc

Issue 2416763002: Replace FOR_EACH_OBSERVER in c/b/chromeos with range-based for (Closed)
Patch Set: Created 4 years, 2 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/chromeos/policy/affiliated_invalidation_service_provide r_impl.h" 5 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide r_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 invalidation_service_ = nullptr; 247 invalidation_service_ = nullptr;
248 SetInvalidationService(invalidation_service); 248 SetInvalidationService(invalidation_service);
249 249
250 if (invalidation_service_ && 250 if (invalidation_service_ &&
251 device_invalidation_service_ && 251 device_invalidation_service_ &&
252 invalidation_service_ != device_invalidation_service_.get()) { 252 invalidation_service_ != device_invalidation_service_.get()) {
253 // If a different invalidation service is being made available to consumers 253 // If a different invalidation service is being made available to consumers
254 // now, destroy the device-global one. 254 // now, destroy the device-global one.
255 DestroyDeviceInvalidationService(); 255 DestroyDeviceInvalidationService();
256 } 256 }
257
258 } 257 }
259 258
260 void 259 void
261 AffiliatedInvalidationServiceProviderImpl::OnInvalidationServiceDisconnected( 260 AffiliatedInvalidationServiceProviderImpl::OnInvalidationServiceDisconnected(
262 invalidation::InvalidationService* invalidation_service) { 261 invalidation::InvalidationService* invalidation_service) {
263 DCHECK(!is_shut_down_); 262 DCHECK(!is_shut_down_);
264 263
265 if (invalidation_service != invalidation_service_) { 264 if (invalidation_service != invalidation_service_) {
266 // If the invalidation service which disconnected was not being made 265 // If the invalidation service which disconnected was not being made
267 // available to consumers, return. 266 // available to consumers, return.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // available to consumers immediately. Otherwise, the invalidation service 328 // available to consumers immediately. Otherwise, the invalidation service
330 // will be made available to clients when it successfully connects. 329 // will be made available to clients when it successfully connects.
331 OnInvalidationServiceConnected(device_invalidation_service_.get()); 330 OnInvalidationServiceConnected(device_invalidation_service_.get());
332 } 331 }
333 } 332 }
334 333
335 void AffiliatedInvalidationServiceProviderImpl::SetInvalidationService( 334 void AffiliatedInvalidationServiceProviderImpl::SetInvalidationService(
336 invalidation::InvalidationService* invalidation_service) { 335 invalidation::InvalidationService* invalidation_service) {
337 DCHECK(!invalidation_service_); 336 DCHECK(!invalidation_service_);
338 invalidation_service_ = invalidation_service; 337 invalidation_service_ = invalidation_service;
339 FOR_EACH_OBSERVER(Consumer, 338 for (auto& observer : consumers_)
340 consumers_, 339 observer.OnInvalidationServiceSet(invalidation_service_);
341 OnInvalidationServiceSet(invalidation_service_));
342 } 340 }
343 341
344 void 342 void
345 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { 343 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() {
346 device_invalidation_service_observer_.reset(); 344 device_invalidation_service_observer_.reset();
347 device_invalidation_service_.reset(); 345 device_invalidation_service_.reset();
348 } 346 }
349 347
350 } // namespace policy 348 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698