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

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

Issue 349153006: Port HistoryService::QueryRedirects{From,To} 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 it != matching_visits.end() && result->size() < max_results; ++it) { 1267 it != matching_visits.end() && result->size() < max_results; ++it) {
1268 result->AppendURLBySwapping(&(*it)); 1268 result->AppendURLBySwapping(&(*it));
1269 } 1269 }
1270 1270
1271 if (matching_visits.size() == result->size() && 1271 if (matching_visits.size() == result->size() &&
1272 options.begin_time <= first_recorded_time_) 1272 options.begin_time <= first_recorded_time_)
1273 result->set_reached_beginning(true); 1273 result->set_reached_beginning(true);
1274 } 1274 }
1275 1275
1276 // Frontend to GetMostRecentRedirectsFrom from the history thread. 1276 // Frontend to GetMostRecentRedirectsFrom from the history thread.
1277 void HistoryBackend::QueryRedirectsFrom( 1277 void HistoryBackend::QueryRedirectsFrom(const GURL& url,
1278 scoped_refptr<QueryRedirectsRequest> request, 1278 QueryRedirectsResult* result) {
1279 const GURL& url) { 1279 result->success = GetMostRecentRedirectsFrom(url, &result->redirects);
droger 2014/06/23 16:50:35 codesearch seems partially broken so this may be w
sdefresne 2014/06/24 13:41:00 It's called multiple times from this file (at leas
1280 if (request->canceled())
1281 return;
1282 bool success = GetMostRecentRedirectsFrom(url, &request->value);
1283 request->ForwardResult(request->handle(), url, success, &request->value);
1284 } 1280 }
1285 1281
1286 void HistoryBackend::QueryRedirectsTo( 1282 void HistoryBackend::QueryRedirectsTo(const GURL& url,
1287 scoped_refptr<QueryRedirectsRequest> request, 1283 QueryRedirectsResult* result) {
1288 const GURL& url) { 1284 result->success = GetMostRecentRedirectsTo(url, &result->redirects);
1289 if (request->canceled())
1290 return;
1291 bool success = GetMostRecentRedirectsTo(url, &request->value);
1292 request->ForwardResult(request->handle(), url, success, &request->value);
1293 } 1285 }
1294 1286
1295 void HistoryBackend::GetVisibleVisitCountToHost( 1287 void HistoryBackend::GetVisibleVisitCountToHost(
1296 scoped_refptr<GetVisibleVisitCountToHostRequest> request, 1288 scoped_refptr<GetVisibleVisitCountToHostRequest> request,
1297 const GURL& url) { 1289 const GURL& url) {
1298 if (request->canceled()) 1290 if (request->canceled())
1299 return; 1291 return;
1300 int count = 0; 1292 int count = 0;
1301 Time first_visit; 1293 Time first_visit;
1302 const bool success = db_.get() && 1294 const bool success = db_.get() &&
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 int rank = kPageVisitStatsMaxTopSites; 2809 int rank = kPageVisitStatsMaxTopSites;
2818 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2810 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2819 if (it != most_visited_urls_map_.end()) 2811 if (it != most_visited_urls_map_.end())
2820 rank = (*it).second; 2812 rank = (*it).second;
2821 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2813 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2822 rank, kPageVisitStatsMaxTopSites + 1); 2814 rank, kPageVisitStatsMaxTopSites + 1);
2823 } 2815 }
2824 #endif 2816 #endif
2825 2817
2826 } // namespace history 2818 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698