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 "chrome/browser/history/visit_tracker.h" | 5 #include "chrome/browser/history/visit_tracker.h" |
6 | 6 |
7 #include "base/logging.h" | |
8 | |
9 namespace history { | 7 namespace history { |
10 | 8 |
11 // When the list gets longer than 'MaxItems', CleanupTransitionList will resize | 9 // 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 | 10 // 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. | 11 // the data rather than constantly shuffle stuff around in the vector. |
14 static const size_t kMaxItemsInTransitionList = 96; | 12 static const size_t kMaxItemsInTransitionList = 96; |
15 static const size_t kResizeBigTransitionListTo = 64; | 13 static const size_t kResizeBigTransitionListTo = 64; |
16 COMPILE_ASSERT(kResizeBigTransitionListTo < kMaxItemsInTransitionList, | 14 COMPILE_ASSERT(kResizeBigTransitionListTo < kMaxItemsInTransitionList, |
17 max_items_must_be_larger_than_resize_to); | 15 max_items_must_be_larger_than_resize_to); |
18 | 16 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 95 |
98 void VisitTracker::CleanupTransitionList(TransitionList* transitions) { | 96 void VisitTracker::CleanupTransitionList(TransitionList* transitions) { |
99 if (transitions->size() <= kMaxItemsInTransitionList) | 97 if (transitions->size() <= kMaxItemsInTransitionList) |
100 return; // Nothing to do. | 98 return; // Nothing to do. |
101 | 99 |
102 transitions->erase(transitions->begin(), | 100 transitions->erase(transitions->begin(), |
103 transitions->begin() + kResizeBigTransitionListTo); | 101 transitions->begin() + kResizeBigTransitionListTo); |
104 } | 102 } |
105 | 103 |
106 } // namespace history | 104 } // namespace history |
OLD | NEW |