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

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

Issue 290083006: Store a stacktrace of PrefService destruction in PrefChangeRegistrar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/prefs/pref_notifier_impl.h ('k') | base/prefs/pref_notifier_impl_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 "base/prefs/pref_notifier_impl.h" 5 #include "base/prefs/pref_notifier_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 PrefInitObserverList observers(init_observers_); 87 PrefInitObserverList observers(init_observers_);
88 init_observers_.clear(); 88 init_observers_.clear();
89 89
90 for (PrefInitObserverList::iterator it = observers.begin(); 90 for (PrefInitObserverList::iterator it = observers.begin();
91 it != observers.end(); 91 it != observers.end();
92 ++it) { 92 ++it) {
93 it->Run(succeeded); 93 it->Run(succeeded);
94 } 94 }
95 } 95 }
96 96
97 // TODO(battre): Delete this. See crbug.com/373435.
98 void PrefNotifierImpl::BroadcastPrefServiceDestructionTrace(
99 const std::string& stack_trace) {
100 DCHECK(thread_checker_.CalledOnValidThread());
101 for (PrefObserverMap::iterator observer_iterator = pref_observers_.begin();
102 observer_iterator != pref_observers_.end();
103 ++observer_iterator) {
104 FOR_EACH_OBSERVER(PrefObserver,
105 *(observer_iterator->second),
106 SetPrefServiceDestructionTrace(stack_trace));
107 }
108 }
109
97 void PrefNotifierImpl::FireObservers(const std::string& path) { 110 void PrefNotifierImpl::FireObservers(const std::string& path) {
98 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
99 112
100 // Only send notifications for registered preferences. 113 // Only send notifications for registered preferences.
101 if (!pref_service_->FindPreference(path.c_str())) 114 if (!pref_service_->FindPreference(path.c_str()))
102 return; 115 return;
103 116
104 const PrefObserverMap::iterator observer_iterator = 117 const PrefObserverMap::iterator observer_iterator =
105 pref_observers_.find(path); 118 pref_observers_.find(path);
106 if (observer_iterator == pref_observers_.end()) 119 if (observer_iterator == pref_observers_.end())
107 return; 120 return;
108 121
109 FOR_EACH_OBSERVER(PrefObserver, 122 FOR_EACH_OBSERVER(PrefObserver,
110 *(observer_iterator->second), 123 *(observer_iterator->second),
111 OnPreferenceChanged(pref_service_, path)); 124 OnPreferenceChanged(pref_service_, path));
112 } 125 }
113 126
114 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) { 127 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) {
115 DCHECK(pref_service_ == NULL); 128 DCHECK(pref_service_ == NULL);
116 pref_service_ = pref_service; 129 pref_service_ = pref_service;
117 } 130 }
OLDNEW
« no previous file with comments | « base/prefs/pref_notifier_impl.h ('k') | base/prefs/pref_notifier_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698