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

Side by Side Diff: base/prefs/pref_member.h

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
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( 115 void MoveToThread(
116 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 116 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
117 117
118 // PrefObserver 118 // PrefObserver
119 virtual void OnPreferenceChanged(PrefService* service, 119 void OnPreferenceChanged(PrefService* service,
120 const std::string& pref_name) OVERRIDE; 120 const std::string& pref_name) override;
121 121
122 void VerifyValuePrefName() const { 122 void VerifyValuePrefName() const {
123 DCHECK(!pref_name_.empty()); 123 DCHECK(!pref_name_.empty());
124 } 124 }
125 125
126 // This method is used to do the actual sync with the preference. 126 // This method is used to do the actual sync with the preference.
127 // Note: it is logically const, because it doesn't modify the state 127 // Note: it is logically const, because it doesn't modify the state
128 // seen by the outside world. It is just doing a lazy load behind the scenes. 128 // seen by the outside world. It is just doing a lazy load behind the scenes.
129 void UpdateValueFromPref(const base::Closure& callback) const; 129 void UpdateValueFromPref(const base::Closure& callback) const;
130 130
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 Internal() : value_(ValueType()) {} 256 Internal() : value_(ValueType()) {}
257 257
258 ValueType value() { 258 ValueType value() {
259 CheckOnCorrectThread(); 259 CheckOnCorrectThread();
260 return value_; 260 return value_;
261 } 261 }
262 262
263 protected: 263 protected:
264 virtual ~Internal() {} 264 virtual ~Internal() {}
265 265
266 virtual BASE_PREFS_EXPORT bool UpdateValueInternal( 266 BASE_PREFS_EXPORT bool UpdateValueInternal(
267 const base::Value& value) const OVERRIDE; 267 const base::Value& value) const override;
268 268
269 // We cache the value of the pref so we don't have to keep walking the pref 269 // We cache the value of the pref so we don't have to keep walking the pref
270 // tree. 270 // tree.
271 mutable ValueType value_; 271 mutable ValueType value_;
272 272
273 DISALLOW_COPY_AND_ASSIGN(Internal); 273 DISALLOW_COPY_AND_ASSIGN(Internal);
274 }; 274 };
275 275
276 virtual Internal* internal() const OVERRIDE { return internal_.get(); } 276 Internal* internal() const override { return internal_.get(); }
277 virtual void CreateInternal() const OVERRIDE { internal_ = new Internal(); } 277 void CreateInternal() const override { internal_ = new Internal(); }
278 278
279 // This method is used to do the actual sync with pref of the specified type. 279 // This method is used to do the actual sync with pref of the specified type.
280 void BASE_PREFS_EXPORT UpdatePref(const ValueType& value); 280 void BASE_PREFS_EXPORT UpdatePref(const ValueType& value);
281 281
282 mutable scoped_refptr<Internal> internal_; 282 mutable scoped_refptr<Internal> internal_;
283 283
284 DISALLOW_COPY_AND_ASSIGN(PrefMember); 284 DISALLOW_COPY_AND_ASSIGN(PrefMember);
285 }; 285 };
286 286
287 // Declaration of template specialization need to be repeated here 287 // Declaration of template specialization need to be repeated here
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 typedef PrefMember<bool> BooleanPrefMember; 346 typedef PrefMember<bool> BooleanPrefMember;
347 typedef PrefMember<int> IntegerPrefMember; 347 typedef PrefMember<int> IntegerPrefMember;
348 typedef PrefMember<double> DoublePrefMember; 348 typedef PrefMember<double> DoublePrefMember;
349 typedef PrefMember<std::string> StringPrefMember; 349 typedef PrefMember<std::string> StringPrefMember;
350 typedef PrefMember<base::FilePath> FilePathPrefMember; 350 typedef PrefMember<base::FilePath> FilePathPrefMember;
351 // This preference member is expensive for large string arrays. 351 // This preference member is expensive for large string arrays.
352 typedef PrefMember<std::vector<std::string> > StringListPrefMember; 352 typedef PrefMember<std::vector<std::string> > StringListPrefMember;
353 353
354 #endif // BASE_PREFS_PREF_MEMBER_H_ 354 #endif // BASE_PREFS_PREF_MEMBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698