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

Side by Side Diff: components/sync/base/immutable.h

Issue 2689773002: [Sync] Replace typedef with using. (Closed)
Patch Set: [Sync] Replace typedef with using. Created 3 years, 10 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
« no previous file with comments | « components/sync/base/extensions_activity.h ('k') | components/sync/base/immutable_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 #ifndef COMPONENTS_SYNC_BASE_IMMUTABLE_H_ 5 #ifndef COMPONENTS_SYNC_BASE_IMMUTABLE_H_
6 #define COMPONENTS_SYNC_BASE_IMMUTABLE_H_ 6 #define COMPONENTS_SYNC_BASE_IMMUTABLE_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // delete *wrapper; 180 // delete *wrapper;
181 // } 181 // }
182 // 182 //
183 // ... 183 // ...
184 // 184 //
185 // Also note that this incurs an additional memory allocation when you 185 // Also note that this incurs an additional memory allocation when you
186 // create an Immutable<SomeOtherType>. 186 // create an Immutable<SomeOtherType>.
187 187
188 template <typename T> 188 template <typename T>
189 struct DefaultImmutableTraits { 189 struct DefaultImmutableTraits {
190 typedef T Wrapper; 190 using Wrapper = T;
191 191
192 static void InitializeWrapper(Wrapper* wrapper) {} 192 static void InitializeWrapper(Wrapper* wrapper) {}
193 193
194 static void DestroyWrapper(Wrapper* wrapper) {} 194 static void DestroyWrapper(Wrapper* wrapper) {}
195 195
196 static const T& Unwrap(const Wrapper& wrapper) { return wrapper; } 196 static const T& Unwrap(const Wrapper& wrapper) { return wrapper; }
197 197
198 static T* UnwrapMutable(Wrapper* wrapper) { return wrapper; } 198 static T* UnwrapMutable(Wrapper* wrapper) { return wrapper; }
199 199
200 static void Swap(T* t1, T* t2) { 200 static void Swap(T* t1, T* t2) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 // Helper function to avoid having to write out template arguments. 239 // Helper function to avoid having to write out template arguments.
240 template <typename T> 240 template <typename T>
241 Immutable<T> MakeImmutable(T* t) { 241 Immutable<T> MakeImmutable(T* t) {
242 return Immutable<T>(t); 242 return Immutable<T>(t);
243 } 243 }
244 244
245 } // namespace syncer 245 } // namespace syncer
246 246
247 #endif // COMPONENTS_SYNC_BASE_IMMUTABLE_H_ 247 #endif // COMPONENTS_SYNC_BASE_IMMUTABLE_H_
OLDNEW
« no previous file with comments | « components/sync/base/extensions_activity.h ('k') | components/sync/base/immutable_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698