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

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

Issue 16160015: Update base/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/json_pref_store_unittest.cc ('k') | 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 virtual BASE_PREFS_EXPORT bool UpdateValueInternal( 264 virtual BASE_PREFS_EXPORT bool UpdateValueInternal(
265 const base::Value& value) const OVERRIDE; 265 const base::Value& value) const OVERRIDE;
266 266
267 // We cache the value of the pref so we don't have to keep walking the pref 267 // We cache the value of the pref so we don't have to keep walking the pref
268 // tree. 268 // tree.
269 mutable ValueType value_; 269 mutable ValueType value_;
270 270
271 DISALLOW_COPY_AND_ASSIGN(Internal); 271 DISALLOW_COPY_AND_ASSIGN(Internal);
272 }; 272 };
273 273
274 virtual Internal* internal() const OVERRIDE { return internal_; } 274 virtual Internal* internal() const OVERRIDE { return internal_.get(); }
275 virtual void CreateInternal() const OVERRIDE { 275 virtual void CreateInternal() const OVERRIDE { internal_ = new Internal(); }
276 internal_ = new Internal();
277 }
278 276
279 // This method is used to do the actual sync with pref of the specified type. 277 // This method is used to do the actual sync with pref of the specified type.
280 void BASE_PREFS_EXPORT UpdatePref(const ValueType& value); 278 void BASE_PREFS_EXPORT UpdatePref(const ValueType& value);
281 279
282 mutable scoped_refptr<Internal> internal_; 280 mutable scoped_refptr<Internal> internal_;
283 281
284 DISALLOW_COPY_AND_ASSIGN(PrefMember); 282 DISALLOW_COPY_AND_ASSIGN(PrefMember);
285 }; 283 };
286 284
287 // Declaration of template specialization need to be repeated here 285 // Declaration of template specialization need to be repeated here
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 343
346 typedef PrefMember<bool> BooleanPrefMember; 344 typedef PrefMember<bool> BooleanPrefMember;
347 typedef PrefMember<int> IntegerPrefMember; 345 typedef PrefMember<int> IntegerPrefMember;
348 typedef PrefMember<double> DoublePrefMember; 346 typedef PrefMember<double> DoublePrefMember;
349 typedef PrefMember<std::string> StringPrefMember; 347 typedef PrefMember<std::string> StringPrefMember;
350 typedef PrefMember<base::FilePath> FilePathPrefMember; 348 typedef PrefMember<base::FilePath> FilePathPrefMember;
351 // This preference member is expensive for large string arrays. 349 // This preference member is expensive for large string arrays.
352 typedef PrefMember<std::vector<std::string> > StringListPrefMember; 350 typedef PrefMember<std::vector<std::string> > StringListPrefMember;
353 351
354 #endif // BASE_PREFS_PREF_MEMBER_H_ 352 #endif // BASE_PREFS_PREF_MEMBER_H_
OLDNEW
« no previous file with comments | « base/prefs/json_pref_store_unittest.cc ('k') | base/prefs/pref_member.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698