Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/browser/history/visit_tracker.cc

Issue 815363002: replace COMPILE_ASSERT with static_assert in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/external_extension_browsertest.cc ('k') | chrome/browser/internal_auth.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stl_util.h" 7 #include "base/stl_util.h"
8 8
9 namespace history { 9 namespace history {
10 10
11 // When the list gets longer than 'MaxItems', CleanupTransitionList will resize 11 // 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 12 // 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. 13 // the data rather than constantly shuffle stuff around in the vector.
14 static const size_t kMaxItemsInTransitionList = 96; 14 static const size_t kMaxItemsInTransitionList = 96;
15 static const size_t kResizeBigTransitionListTo = 64; 15 static const size_t kResizeBigTransitionListTo = 64;
16 COMPILE_ASSERT(kResizeBigTransitionListTo < kMaxItemsInTransitionList, 16 static_assert(kResizeBigTransitionListTo < kMaxItemsInTransitionList,
17 max_items_must_be_larger_than_resize_to); 17 "maxium number of items must be larger than we are resizing to");
18 18
19 VisitTracker::VisitTracker() { 19 VisitTracker::VisitTracker() {
20 } 20 }
21 21
22 VisitTracker::~VisitTracker() { 22 VisitTracker::~VisitTracker() {
23 STLDeleteContainerPairSecondPointers(contexts_.begin(), contexts_.end()); 23 STLDeleteContainerPairSecondPointers(contexts_.begin(), contexts_.end());
24 } 24 }
25 25
26 // This function is potentially slow because it may do up to two brute-force 26 // This function is potentially slow because it may do up to two brute-force
27 // searches of the transitions list. This transitions list is kept to a 27 // searches of the transitions list. This transitions list is kept to a
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 void VisitTracker::CleanupTransitionList(TransitionList* transitions) { 98 void VisitTracker::CleanupTransitionList(TransitionList* transitions) {
99 if (transitions->size() <= kMaxItemsInTransitionList) 99 if (transitions->size() <= kMaxItemsInTransitionList)
100 return; // Nothing to do. 100 return; // Nothing to do.
101 101
102 transitions->erase(transitions->begin(), 102 transitions->erase(transitions->begin(),
103 transitions->begin() + kResizeBigTransitionListTo); 103 transitions->begin() + kResizeBigTransitionListTo);
104 } 104 }
105 105
106 } // namespace history 106 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/external_extension_browsertest.cc ('k') | chrome/browser/internal_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698