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

Side by Side Diff: components/history/core/browser/history_database.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
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 "components/history/core/browser/history_database.h" 5 #include "components/history/core/browser/history_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 // Collect a map from host to visit count. 203 // Collect a map from host to visit count.
204 base::hash_map<std::string, int> host_count; 204 base::hash_map<std::string, int> host_count;
205 while (url_sql.Step()) { 205 while (url_sql.Step()) {
206 GURL url(url_sql.ColumnString(0)); 206 GURL url(url_sql.ColumnString(0));
207 if (!(url.is_valid() && (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs("ftp")))) 207 if (!(url.is_valid() && (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs("ftp"))))
208 continue; 208 continue;
209 209
210 int64 visit_count = url_sql.ColumnInt64(1); 210 int64 visit_count = url_sql.ColumnInt64(1);
211 std::string host = url.host(); 211 std::string host = url.host();
212 if (StartsWithASCII(host, "www.", true)) 212 if (base::StartsWithASCII(host, "www.", true))
213 host.assign(host, 4, std::string::npos); 213 host.assign(host, 4, std::string::npos);
214 host_count[host] += visit_count; 214 host_count[host] += visit_count;
215 215
216 // kMaxHostsInMemory is well above typical values for 216 // kMaxHostsInMemory is well above typical values for
217 // History.MonthlyHostCount, but here to guard against unbounded memory 217 // History.MonthlyHostCount, but here to guard against unbounded memory
218 // growth in the event of an atypical history. 218 // growth in the event of an atypical history.
219 if (host_count.size() >= kMaxHostsInMemory) 219 if (host_count.size() >= kMaxHostsInMemory)
220 break; 220 break;
221 } 221 }
222 222
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 "SET visit_time = visit_time + 11644473600000000 " 510 "SET visit_time = visit_time + 11644473600000000 "
511 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); 511 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);"));
512 ignore_result(db_.Execute( 512 ignore_result(db_.Execute(
513 "UPDATE segment_usage " 513 "UPDATE segment_usage "
514 "SET time_slot = time_slot + 11644473600000000 " 514 "SET time_slot = time_slot + 11644473600000000 "
515 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); 515 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);"));
516 } 516 }
517 #endif 517 #endif
518 518
519 } // namespace history 519 } // namespace history
OLDNEW
« no previous file with comments | « components/google/core/browser/google_util.cc ('k') | components/html_viewer/web_mime_registry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698