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

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: Fix Linux ASAN tests Created 6 years, 5 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 | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_marshaling.h » ('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/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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 1270
1271 URLID to_url_id = db_->GetRowForURL(to_url, NULL); 1271 URLID to_url_id = db_->GetRowForURL(to_url, NULL);
1272 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL); 1272 VisitID cur_visit = db_->GetMostRecentVisitForURL(to_url_id, NULL);
1273 if (!cur_visit) 1273 if (!cur_visit)
1274 return; // No visits for URL. 1274 return; // No visits for URL.
1275 1275
1276 GetRedirectsToSpecificVisit(cur_visit, redirects); 1276 GetRedirectsToSpecificVisit(cur_visit, redirects);
1277 } 1277 }
1278 1278
1279 void HistoryBackend::GetVisibleVisitCountToHost( 1279 void HistoryBackend::GetVisibleVisitCountToHost(
1280 scoped_refptr<GetVisibleVisitCountToHostRequest> request, 1280 const GURL& url,
1281 const GURL& url) { 1281 VisibleVisitCountToHostResult* result) {
1282 if (request->canceled()) 1282 result->count = 0;
1283 return; 1283 result->success = db_.get() &&
1284 int count = 0; 1284 db_->GetVisibleVisitCountToHost(
1285 Time first_visit; 1285 url, &result->count, &result->first_visit);
1286 const bool success = db_.get() &&
1287 db_->GetVisibleVisitCountToHost(url, &count, &first_visit);
1288 request->ForwardResult(request->handle(), success, count, first_visit);
1289 } 1286 }
1290 1287
1291 void HistoryBackend::QueryMostVisitedURLs(int result_count, 1288 void HistoryBackend::QueryMostVisitedURLs(int result_count,
1292 int days_back, 1289 int days_back,
1293 MostVisitedURLList* result) { 1290 MostVisitedURLList* result) {
1294 if (!db_) 1291 if (!db_)
1295 return; 1292 return;
1296 1293
1297 ScopedVector<PageUsageData> data; 1294 ScopedVector<PageUsageData> data;
1298 db_->QuerySegmentUsage( 1295 db_->QuerySegmentUsage(
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 int rank = kPageVisitStatsMaxTopSites; 2720 int rank = kPageVisitStatsMaxTopSites;
2724 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2721 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2725 if (it != most_visited_urls_map_.end()) 2722 if (it != most_visited_urls_map_.end())
2726 rank = (*it).second; 2723 rank = (*it).second;
2727 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2724 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2728 rank, kPageVisitStatsMaxTopSites + 1); 2725 rank, kPageVisitStatsMaxTopSites + 1);
2729 } 2726 }
2730 #endif 2727 #endif
2731 2728
2732 } // namespace history 2729 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_marshaling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698