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

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

Issue 351553004: Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 QueryRedirectsResult* result) { 1278 QueryRedirectsResult* result) {
1279 result->success = GetMostRecentRedirectsFrom(url, &result->redirects); 1279 result->success = GetMostRecentRedirectsFrom(url, &result->redirects);
1280 } 1280 }
1281 1281
1282 void HistoryBackend::QueryRedirectsTo(const GURL& url, 1282 void HistoryBackend::QueryRedirectsTo(const GURL& url,
1283 QueryRedirectsResult* result) { 1283 QueryRedirectsResult* result) {
1284 result->success = GetMostRecentRedirectsTo(url, &result->redirects); 1284 result->success = GetMostRecentRedirectsTo(url, &result->redirects);
1285 } 1285 }
1286 1286
1287 void HistoryBackend::GetVisibleVisitCountToHost( 1287 void HistoryBackend::GetVisibleVisitCountToHost(
1288 scoped_refptr<GetVisibleVisitCountToHostRequest> request, 1288 const GURL& url,
1289 const GURL& url) { 1289 VisibleVisitCountToHostResult* result) {
1290 if (request->canceled()) 1290 result->count = 0;
1291 return; 1291 result->success = db_.get() &&
1292 int count = 0; 1292 db_->GetVisibleVisitCountToHost(
1293 Time first_visit; 1293 url, &result->count, &result->first_visit);
1294 const bool success = db_.get() &&
1295 db_->GetVisibleVisitCountToHost(url, &count, &first_visit);
1296 request->ForwardResult(request->handle(), success, count, first_visit);
1297 } 1294 }
1298 1295
1299 void HistoryBackend::QueryTopURLsAndRedirects( 1296 void HistoryBackend::QueryTopURLsAndRedirects(
1300 scoped_refptr<QueryTopURLsAndRedirectsRequest> request, 1297 scoped_refptr<QueryTopURLsAndRedirectsRequest> request,
1301 int result_count) { 1298 int result_count) {
1302 if (request->canceled()) 1299 if (request->canceled())
1303 return; 1300 return;
1304 1301
1305 if (!db_) { 1302 if (!db_) {
1306 request->ForwardResult(request->handle(), false, NULL, NULL); 1303 request->ForwardResult(request->handle(), false, NULL, NULL);
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 int rank = kPageVisitStatsMaxTopSites; 2806 int rank = kPageVisitStatsMaxTopSites;
2810 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2807 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2811 if (it != most_visited_urls_map_.end()) 2808 if (it != most_visited_urls_map_.end())
2812 rank = (*it).second; 2809 rank = (*it).second;
2813 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2810 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2814 rank, kPageVisitStatsMaxTopSites + 1); 2811 rank, kPageVisitStatsMaxTopSites + 1);
2815 } 2812 }
2816 #endif 2813 #endif
2817 2814
2818 } // namespace history 2815 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698