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