OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/history/core/browser/visit_tracker.h" | 5 #include "components/history/core/browser/visit_tracker.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
8 | 10 |
9 namespace history { | 11 namespace history { |
10 | 12 |
11 // When the list gets longer than 'MaxItems', CleanupTransitionList will resize | 13 // When the list gets longer than 'MaxItems', CleanupTransitionList will resize |
12 // the list down to 'ResizeTo' size. This is so we only do few block moves of | 14 // the list down to 'ResizeTo' size. This is so we only do few block moves of |
13 // the data rather than constantly shuffle stuff around in the vector. | 15 // the data rather than constantly shuffle stuff around in the vector. |
14 static const size_t kMaxItemsInTransitionList = 96; | 16 static const size_t kMaxItemsInTransitionList = 96; |
15 static const size_t kResizeBigTransitionListTo = 64; | 17 static const size_t kResizeBigTransitionListTo = 64; |
16 static_assert(kResizeBigTransitionListTo < kMaxItemsInTransitionList, | 18 static_assert(kResizeBigTransitionListTo < kMaxItemsInTransitionList, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 101 |
100 void VisitTracker::CleanupTransitionList(TransitionList* transitions) { | 102 void VisitTracker::CleanupTransitionList(TransitionList* transitions) { |
101 if (transitions->size() <= kMaxItemsInTransitionList) | 103 if (transitions->size() <= kMaxItemsInTransitionList) |
102 return; // Nothing to do. | 104 return; // Nothing to do. |
103 | 105 |
104 transitions->erase(transitions->begin(), | 106 transitions->erase(transitions->begin(), |
105 transitions->begin() + kResizeBigTransitionListTo); | 107 transitions->begin() + kResizeBigTransitionListTo); |
106 } | 108 } |
107 | 109 |
108 } // namespace history | 110 } // namespace history |
OLD | NEW |