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

Side by Side Diff: chrome/browser/prefs/synced_pref_change_registrar.cc

Issue 90563003: Fix a race condition in preference metric reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/prefs/synced_pref_change_registrar.h" 5 #include "chrome/browser/prefs/synced_pref_change_registrar.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/prefs/pref_service_syncable.h"
8 9
9 namespace { 10 namespace {
10 11
11 void InvokeUnnamedCallback( 12 void InvokeUnnamedCallback(
12 const SyncedPrefChangeRegistrar::ChangeCallback& callback, 13 const SyncedPrefChangeRegistrar::ChangeCallback& callback,
13 const std::string& path, 14 const std::string& path,
14 bool from_sync) { 15 bool from_sync) {
15 callback.Run(from_sync); 16 callback.Run(from_sync);
16 } 17 }
17 18
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 void SyncedPrefChangeRegistrar::OnSyncedPrefChanged(const std::string& path, 59 void SyncedPrefChangeRegistrar::OnSyncedPrefChanged(const std::string& path,
59 bool from_sync) { 60 bool from_sync) {
60 if (pref_service_->IsManagedPreference(path.c_str())) 61 if (pref_service_->IsManagedPreference(path.c_str()))
61 return; 62 return;
62 ObserverMap::const_iterator iter = observers_.find(path); 63 ObserverMap::const_iterator iter = observers_.find(path);
63 if (iter == observers_.end()) 64 if (iter == observers_.end())
64 return; 65 return;
65 iter->second.Run(path, from_sync); 66 iter->second.Run(path, from_sync);
66 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698