| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // used by providing your own traits class or using one of the | 57 // used by providing your own traits class or using one of the |
| 58 // pre-defined ones below. See comments on traits below for details. | 58 // pre-defined ones below. See comments on traits below for details. |
| 59 // | 59 // |
| 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 COMPONENTS_SYNC_BASE_IMMUTABLE_H_ | 64 #ifndef COMPONENTS_SYNC_BASE_IMMUTABLE_H_ |
| 65 #define COMPONENTS_SYNC_BASE_IMMUTABLE_H_ | 65 #define COMPONENTS_SYNC_BASE_IMMUTABLE_H_ |
| 66 | 66 |
| 67 // For std::swap(). | 67 #include <utility> |
| 68 #include <algorithm> | |
| 69 | 68 |
| 70 #include "base/macros.h" | 69 #include "base/macros.h" |
| 71 #include "base/memory/ref_counted.h" | 70 #include "base/memory/ref_counted.h" |
| 72 | 71 |
| 73 namespace syncer { | 72 namespace syncer { |
| 74 | 73 |
| 75 namespace internal { | 74 namespace internal { |
| 76 // This class is part of the Immutable implementation. DO NOT USE | 75 // This class is part of the Immutable implementation. DO NOT USE |
| 77 // THIS CLASS DIRECTLY YOURSELF. | 76 // THIS CLASS DIRECTLY YOURSELF. |
| 78 | 77 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 238 |
| 240 // Helper function to avoid having to write out template arguments. | 239 // Helper function to avoid having to write out template arguments. |
| 241 template <typename T> | 240 template <typename T> |
| 242 Immutable<T> MakeImmutable(T* t) { | 241 Immutable<T> MakeImmutable(T* t) { |
| 243 return Immutable<T>(t); | 242 return Immutable<T>(t); |
| 244 } | 243 } |
| 245 | 244 |
| 246 } // namespace syncer | 245 } // namespace syncer |
| 247 | 246 |
| 248 #endif // COMPONENTS_SYNC_BASE_IMMUTABLE_H_ | 247 #endif // COMPONENTS_SYNC_BASE_IMMUTABLE_H_ |
| OLD | NEW |