| OLD | NEW |
| 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 // Immutable<T> provides an easy, cheap, and thread-safe way to pass | 5 // Immutable<T> provides an easy, cheap, and thread-safe way to pass |
| 6 // large immutable data around. | 6 // large immutable data around. |
| 7 // | 7 // |
| 8 // For example, consider the following code: | 8 // For example, consider the following code: |
| 9 // | 9 // |
| 10 // typedef std::vector<LargeObject> LargeObjectList; | 10 // typedef std::vector<LargeObject> LargeObjectList; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // NOTE: Some complexity is necessary in order to use Immutable<T> | 60 // NOTE: Some complexity is necessary in order to use Immutable<T> |
| 61 // with forward-declared types. See comments on traits below for | 61 // with forward-declared types. See comments on traits below for |
| 62 // details. | 62 // details. |
| 63 | 63 |
| 64 #ifndef SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ | 64 #ifndef SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ |
| 65 #define SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ | 65 #define SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ |
| 66 | 66 |
| 67 // For std::swap(). | 67 // For std::swap(). |
| 68 #include <algorithm> | 68 #include <algorithm> |
| 69 | 69 |
| 70 #include "base/basictypes.h" | 70 #include "base/macros.h" |
| 71 #include "base/memory/ref_counted.h" | 71 #include "base/memory/ref_counted.h" |
| 72 | 72 |
| 73 namespace syncer { | 73 namespace syncer { |
| 74 | 74 |
| 75 namespace internal { | 75 namespace internal { |
| 76 // This class is part of the Immutable implementation. DO NOT USE | 76 // This class is part of the Immutable implementation. DO NOT USE |
| 77 // THIS CLASS DIRECTLY YOURSELF. | 77 // THIS CLASS DIRECTLY YOURSELF. |
| 78 | 78 |
| 79 template <typename T, typename Traits> | 79 template <typename T, typename Traits> |
| 80 class ImmutableCore | 80 class ImmutableCore |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 // Helper function to avoid having to write out template arguments. | 253 // Helper function to avoid having to write out template arguments. |
| 254 template <typename T> | 254 template <typename T> |
| 255 Immutable<T> MakeImmutable(T* t) { | 255 Immutable<T> MakeImmutable(T* t) { |
| 256 return Immutable<T>(t); | 256 return Immutable<T>(t); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace syncer | 259 } // namespace syncer |
| 260 | 260 |
| 261 #endif // SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ | 261 #endif // SYNC_INTERNAL_API_PUBLIC_UTIL_IMMUTABLE_H_ |
| OLD | NEW |