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/history/core/browser/top_sites_cache.h" | 5 #include "components/history/core/browser/top_sites_cache.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 | 9 |
10 namespace history { | 10 namespace history { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 void TopSitesCache::CountForcedURLs() { | 131 void TopSitesCache::CountForcedURLs() { |
132 num_forced_urls_ = 0; | 132 num_forced_urls_ = 0; |
133 while (num_forced_urls_ < top_sites_.size()) { | 133 while (num_forced_urls_ < top_sites_.size()) { |
134 // Forced sites are all at the beginning. | 134 // Forced sites are all at the beginning. |
135 if (top_sites_[num_forced_urls_].last_forced_time.is_null()) | 135 if (top_sites_[num_forced_urls_].last_forced_time.is_null()) |
136 break; | 136 break; |
137 num_forced_urls_++; | 137 num_forced_urls_++; |
138 } | 138 } |
139 #if DCHECK_IS_ON | 139 #if DCHECK_IS_ON() |
140 // In debug, ensure the cache user has no forced URLs pass that point. | 140 // In debug, ensure the cache user has no forced URLs pass that point. |
141 for (size_t i = num_forced_urls_; i < top_sites_.size(); ++i) { | 141 for (size_t i = num_forced_urls_; i < top_sites_.size(); ++i) { |
142 DCHECK(top_sites_[i].last_forced_time.is_null()) | 142 DCHECK(top_sites_[i].last_forced_time.is_null()) |
143 << "All the forced URLs must appear before non-forced URLs."; | 143 << "All the forced URLs must appear before non-forced URLs."; |
144 } | 144 } |
145 #endif | 145 #endif |
146 } | 146 } |
147 | 147 |
148 void TopSitesCache::GenerateCanonicalURLs() { | 148 void TopSitesCache::GenerateCanonicalURLs() { |
149 canonical_urls_.clear(); | 149 canonical_urls_.clear(); |
(...skipping 23 matching lines...) Expand all Loading... |
173 return canonical_urls_.find(CanonicalURLQuery(url).entry()); | 173 return canonical_urls_.find(CanonicalURLQuery(url).entry()); |
174 } | 174 } |
175 | 175 |
176 const GURL& TopSitesCache::GetURLFromIterator( | 176 const GURL& TopSitesCache::GetURLFromIterator( |
177 CanonicalURLs::const_iterator it) const { | 177 CanonicalURLs::const_iterator it) const { |
178 DCHECK(it != canonical_urls_.end()); | 178 DCHECK(it != canonical_urls_.end()); |
179 return it->first.first->redirects[it->first.second]; | 179 return it->first.first->redirects[it->first.second]; |
180 } | 180 } |
181 | 181 |
182 } // namespace history | 182 } // namespace history |
OLD | NEW |