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

Side by Side Diff: trunk/src/base/prefs/pref_notifier_impl.h

Issue 289373006: Revert 271416 "Store a stacktrace of PrefService destruction in ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | « trunk/src/base/prefs/pref_notifier.h ('k') | trunk/src/base/prefs/pref_notifier_impl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_ 5 #ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_
6 #define BASE_PREFS_PREF_NOTIFIER_IMPL_H_ 6 #define BASE_PREFS_PREF_NOTIFIER_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 // parameter will be set to true for successful initialization, 36 // parameter will be set to true for successful initialization,
37 // false for unsuccessful. 37 // false for unsuccessful.
38 void AddInitObserver(base::Callback<void(bool)> observer); 38 void AddInitObserver(base::Callback<void(bool)> observer);
39 39
40 void SetPrefService(PrefService* pref_service); 40 void SetPrefService(PrefService* pref_service);
41 41
42 protected: 42 protected:
43 // PrefNotifier overrides. 43 // PrefNotifier overrides.
44 virtual void OnPreferenceChanged(const std::string& pref_name) OVERRIDE; 44 virtual void OnPreferenceChanged(const std::string& pref_name) OVERRIDE;
45 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; 45 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE;
46 // TODO(battre): Delete this. See crbug.com/373435.
47 virtual void BroadcastPrefServiceDestructionTrace(
48 const std::string& stack_trace) OVERRIDE;
49 46
50 // A map from pref names to a list of observers. Observers get fired in the 47 // A map from pref names to a list of observers. Observers get fired in the
51 // order they are added. These should only be accessed externally for unit 48 // order they are added. These should only be accessed externally for unit
52 // testing. 49 // testing.
53 typedef ObserverList<PrefObserver> PrefObserverList; 50 typedef ObserverList<PrefObserver> PrefObserverList;
54 typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap; 51 typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap;
55 52
56 typedef std::list<base::Callback<void(bool)> > PrefInitObserverList; 53 typedef std::list<base::Callback<void(bool)> > PrefInitObserverList;
57 54
58 const PrefObserverMap* pref_observers() const { return &pref_observers_; } 55 const PrefObserverMap* pref_observers() const { return &pref_observers_; }
59 56
60 private: 57 private:
61 // For the given pref_name, fire any observer of the pref. Virtual so it can 58 // For the given pref_name, fire any observer of the pref. Virtual so it can
62 // be mocked for unit testing. 59 // be mocked for unit testing.
63 virtual void FireObservers(const std::string& path); 60 virtual void FireObservers(const std::string& path);
64 61
65 // Weak reference; the notifier is owned by the PrefService. 62 // Weak reference; the notifier is owned by the PrefService.
66 PrefService* pref_service_; 63 PrefService* pref_service_;
67 64
68 PrefObserverMap pref_observers_; 65 PrefObserverMap pref_observers_;
69 PrefInitObserverList init_observers_; 66 PrefInitObserverList init_observers_;
70 67
71 base::ThreadChecker thread_checker_; 68 base::ThreadChecker thread_checker_;
72 69
73 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); 70 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl);
74 }; 71 };
75 72
76 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_ 73 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_
OLDNEW
« no previous file with comments | « trunk/src/base/prefs/pref_notifier.h ('k') | trunk/src/base/prefs/pref_notifier_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698