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 #include "base/trace_event/memory_usage_estimator.h" | |
10 | 11 |
11 namespace syncer { | 12 namespace syncer { |
12 | 13 |
13 class ProcessorEntityTracker; | 14 class ProcessorEntityTracker; |
14 struct EntityData; | 15 struct EntityData; |
15 | 16 |
16 namespace syncable { | 17 namespace syncable { |
17 struct EntryKernel; | 18 struct EntryKernel; |
18 } // namespace syncable | 19 } // namespace syncable |
19 | 20 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 121 |
121 void load(const void* blob, int length) { | 122 void load(const void* blob, int length) { |
122 wrapper_ = Wrapper::ParseFromBlob(blob, length); | 123 wrapper_ = Wrapper::ParseFromBlob(blob, length); |
123 } | 124 } |
124 | 125 |
125 scoped_refptr<Wrapper> wrapper_; | 126 scoped_refptr<Wrapper> wrapper_; |
126 }; | 127 }; |
127 | 128 |
128 template <typename T, typename Traits> | 129 template <typename T, typename Traits> |
129 size_t EstimateMemoryUsage(const ProtoValuePtr<T, Traits>& ptr) { | 130 size_t EstimateMemoryUsage(const ProtoValuePtr<T, Traits>& ptr) { |
131 using base::trace_event::EstimateMemoryUsage; | |
Patrick Noland
2017/03/29 19:42:54
Can you add a comment explaining what this is for?
pavely
2017/03/30 01:07:24
Done.
| |
130 return &ptr.value() != &Traits::DefaultValue() | 132 return &ptr.value() != &Traits::DefaultValue() |
131 ? EstimateMemoryUsage(ptr.value()) | 133 ? EstimateMemoryUsage(ptr.value()) |
132 : 0; | 134 : 0; |
133 } | 135 } |
134 | 136 |
135 } // namespace syncer | 137 } // namespace syncer |
136 | 138 |
137 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ | 139 #endif // COMPONENTS_SYNC_BASE_PROTO_VALUE_PTR_H_ |
OLD | NEW |