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

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

Issue 195973002: Change DCHECK_IS_ON() to DCHECK_IS_ON (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep a comment Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/tree_synchronizer.cc ('k') | chrome/common/logging_chrome.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) 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 "chrome/browser/history/top_sites_cache.h" 5 #include "chrome/browser/history/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
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 // 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.
140 if (DCHECK_IS_ON()) { 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 }
145 } 144 }
145 #endif
146 } 146 }
147 147
148 void TopSitesCache::GenerateCanonicalURLs() { 148 void TopSitesCache::GenerateCanonicalURLs() {
149 canonical_urls_.clear(); 149 canonical_urls_.clear();
150 for (size_t i = 0; i < top_sites_.size(); i++) 150 for (size_t i = 0; i < top_sites_.size(); i++)
151 StoreRedirectChain(top_sites_[i].redirects, i); 151 StoreRedirectChain(top_sites_[i].redirects, i);
152 } 152 }
153 153
154 void TopSitesCache::StoreRedirectChain(const RedirectList& redirects, 154 void TopSitesCache::StoreRedirectChain(const RedirectList& redirects,
155 size_t destination) { 155 size_t destination) {
(...skipping 17 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « cc/trees/tree_synchronizer.cc ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698