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 #include "components/sync/base/unique_position.h" | 5 #include "components/sync/base/unique_position.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <limits> | 11 #include <limits> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/trace_event/memory_usage_estimators.h" |
17 #include "components/sync/protocol/unique_position.pb.h" | 18 #include "components/sync/protocol/unique_position.pb.h" |
18 #include "third_party/zlib/zlib.h" | 19 #include "third_party/zlib/zlib.h" |
19 | 20 |
20 namespace syncer { | 21 namespace syncer { |
21 | 22 |
22 const size_t UniquePosition::kSuffixLength = 28; | 23 const size_t UniquePosition::kSuffixLength = 28; |
23 const size_t UniquePosition::kCompressBytesThreshold = 128; | 24 const size_t UniquePosition::kCompressBytesThreshold = 128; |
24 | 25 |
25 // static. | 26 // static. |
26 bool UniquePosition::IsValidSuffix(const std::string& suffix) { | 27 bool UniquePosition::IsValidSuffix(const std::string& suffix) { |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 // this is not the highest possible count. | 611 // this is not the highest possible count. |
611 return false; | 612 return false; |
612 } | 613 } |
613 } | 614 } |
614 } | 615 } |
615 // We don't bother looking for the existence or checking the validity of | 616 // We don't bother looking for the existence or checking the validity of |
616 // any partial blocks. There's no way they could be invalid anyway. | 617 // any partial blocks. There's no way they could be invalid anyway. |
617 return true; | 618 return true; |
618 } | 619 } |
619 | 620 |
| 621 size_t UniquePosition::EstimateMemoryUsage() const { |
| 622 using base::trace_event::EstimateMemoryUsage; |
| 623 return EstimateMemoryUsage(compressed_); |
| 624 } |
| 625 |
620 } // namespace syncer | 626 } // namespace syncer |
OLD | NEW |