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

Side by Side Diff: components/prefs/pref_notifier_impl.cc

Issue 2444753002: Reduce usage of FOR_EACH_OBSERVER macro in components/ (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
« no previous file with comments | « components/prefs/overlay_user_pref_store.cc ('k') | components/prefs/testing_pref_store.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 "components/prefs/pref_notifier_impl.h" 5 #include "components/prefs/pref_notifier_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "components/prefs/pref_service.h" 9 #include "components/prefs/pref_service.h"
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 DCHECK(thread_checker_.CalledOnValidThread()); 86 DCHECK(thread_checker_.CalledOnValidThread());
87 87
88 // Only send notifications for registered preferences. 88 // Only send notifications for registered preferences.
89 if (!pref_service_->FindPreference(path)) 89 if (!pref_service_->FindPreference(path))
90 return; 90 return;
91 91
92 auto observer_iterator = pref_observers_.find(path); 92 auto observer_iterator = pref_observers_.find(path);
93 if (observer_iterator == pref_observers_.end()) 93 if (observer_iterator == pref_observers_.end())
94 return; 94 return;
95 95
96 FOR_EACH_OBSERVER(PrefObserver, 96 for (PrefObserver& observer : *(observer_iterator->second))
97 *(observer_iterator->second), 97 observer.OnPreferenceChanged(pref_service_, path);
98 OnPreferenceChanged(pref_service_, path));
99 } 98 }
100 99
101 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) { 100 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) {
102 DCHECK(pref_service_ == nullptr); 101 DCHECK(pref_service_ == nullptr);
103 pref_service_ = pref_service; 102 pref_service_ = pref_service;
104 } 103 }
OLDNEW
« no previous file with comments | « components/prefs/overlay_user_pref_store.cc ('k') | components/prefs/testing_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698