OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROTO_VALUE_PTR_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ |
6 #define COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ | 6 #define COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void load(const void* blob, int length) { | 121 void load(const void* blob, int length) { |
122 wrapper_ = Wrapper::ParseFromBlob(blob, length); | 122 wrapper_ = Wrapper::ParseFromBlob(blob, length); |
123 } | 123 } |
124 | 124 |
125 scoped_refptr<Wrapper> wrapper_; | 125 scoped_refptr<Wrapper> wrapper_; |
126 }; | 126 }; |
127 | 127 |
| 128 template <typename T, typename Traits> |
| 129 size_t EstimateMemoryUsage(const ProtoValuePtr<T, Traits>& ptr) { |
| 130 return &ptr.value() != &Traits::DefaultValue() |
| 131 ? EstimateMemoryUsage(ptr.value()) |
| 132 : 0; |
| 133 } |
| 134 |
128 } // namespace syncer | 135 } // namespace syncer |
129 | 136 |
130 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ | 137 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ |
OLD | NEW |