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

Side by Side Diff: trunk/src/base/prefs/pref_member.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_change_registrar.cc ('k') | trunk/src/base/prefs/pref_member.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 // A helper class that stays in sync with a preference (bool, int, real, 5 // A helper class that stays in sync with a preference (bool, int, real,
6 // string or filepath). For example: 6 // string or filepath). For example:
7 // 7 //
8 // class MyClass { 8 // class MyClass {
9 // public: 9 // public:
10 // MyClass(PrefService* prefs) { 10 // MyClass(PrefService* prefs) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 virtual void CreateInternal() const = 0; 110 virtual void CreateInternal() const = 0;
111 111
112 // See PrefMember<> for description. 112 // See PrefMember<> for description.
113 void Destroy(); 113 void Destroy();
114 114
115 void MoveToThread(const scoped_refptr<base::MessageLoopProxy>& message_loop); 115 void MoveToThread(const scoped_refptr<base::MessageLoopProxy>& message_loop);
116 116
117 // PrefObserver 117 // PrefObserver
118 virtual void OnPreferenceChanged(PrefService* service, 118 virtual void OnPreferenceChanged(PrefService* service,
119 const std::string& pref_name) OVERRIDE; 119 const std::string& pref_name) OVERRIDE;
120 // TODO(battre): Remove function (debugging tool for crbug.com/373435).
121 virtual void SetPrefServiceDestructionTrace(
122 const std::string& stack_trace) OVERRIDE;
123 120
124 void VerifyValuePrefName() const { 121 void VerifyValuePrefName() const {
125 DCHECK(!pref_name_.empty()); 122 DCHECK(!pref_name_.empty());
126 } 123 }
127 124
128 // This method is used to do the actual sync with the preference. 125 // This method is used to do the actual sync with the preference.
129 // Note: it is logically const, because it doesn't modify the state 126 // Note: it is logically const, because it doesn't modify the state
130 // seen by the outside world. It is just doing a lazy load behind the scenes. 127 // seen by the outside world. It is just doing a lazy load behind the scenes.
131 void UpdateValueFromPref(const base::Closure& callback) const; 128 void UpdateValueFromPref(const base::Closure& callback) const;
132 129
133 // Verifies the preference name, and lazily loads the preference value if 130 // Verifies the preference name, and lazily loads the preference value if
134 // it hasn't been loaded yet. 131 // it hasn't been loaded yet.
135 void VerifyPref() const; 132 void VerifyPref() const;
136 133
137 const std::string& pref_name() const { return pref_name_; } 134 const std::string& pref_name() const { return pref_name_; }
138 135
139 virtual Internal* internal() const = 0; 136 virtual Internal* internal() const = 0;
140 137
141 // Used to allow registering plain base::Closure callbacks. 138 // Used to allow registering plain base::Closure callbacks.
142 static void InvokeUnnamedCallback(const base::Closure& callback, 139 static void InvokeUnnamedCallback(const base::Closure& callback,
143 const std::string& pref_name); 140 const std::string& pref_name);
144 141
145 private: 142 private:
146 // Ordered the members to compact the class instance. 143 // Ordered the members to compact the class instance.
147 std::string pref_name_; 144 std::string pref_name_;
148 NamedChangeCallback observer_; 145 NamedChangeCallback observer_;
149 PrefService* prefs_; 146 PrefService* prefs_;
150 // TODO(battre): Remove attribute (debugging tool for crbug.com/373435).
151 std::string pref_service_destruction_;
152 147
153 protected: 148 protected:
154 bool setting_value_; 149 bool setting_value_;
155 }; 150 };
156 151
157 // This function implements StringListPrefMember::UpdateValue(). 152 // This function implements StringListPrefMember::UpdateValue().
158 // It is exposed here for testing purposes. 153 // It is exposed here for testing purposes.
159 bool BASE_PREFS_EXPORT PrefMemberVectorStringUpdate( 154 bool BASE_PREFS_EXPORT PrefMemberVectorStringUpdate(
160 const base::Value& value, 155 const base::Value& value,
161 std::vector<std::string>* string_vector); 156 std::vector<std::string>* string_vector);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 343
349 typedef PrefMember<bool> BooleanPrefMember; 344 typedef PrefMember<bool> BooleanPrefMember;
350 typedef PrefMember<int> IntegerPrefMember; 345 typedef PrefMember<int> IntegerPrefMember;
351 typedef PrefMember<double> DoublePrefMember; 346 typedef PrefMember<double> DoublePrefMember;
352 typedef PrefMember<std::string> StringPrefMember; 347 typedef PrefMember<std::string> StringPrefMember;
353 typedef PrefMember<base::FilePath> FilePathPrefMember; 348 typedef PrefMember<base::FilePath> FilePathPrefMember;
354 // This preference member is expensive for large string arrays. 349 // This preference member is expensive for large string arrays.
355 typedef PrefMember<std::vector<std::string> > StringListPrefMember; 350 typedef PrefMember<std::vector<std::string> > StringListPrefMember;
356 351
357 #endif // BASE_PREFS_PREF_MEMBER_H_ 352 #endif // BASE_PREFS_PREF_MEMBER_H_
OLDNEW
« no previous file with comments | « trunk/src/base/prefs/pref_change_registrar.cc ('k') | trunk/src/base/prefs/pref_member.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698