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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 314293005: Change HistoryService::QueryURL to use CancelableTaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment for scoped_ptr usage 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
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/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 histograms_->RecordConcurrency(active_prerenders_.size()); 1366 histograms_->RecordConcurrency(active_prerenders_.size());
1367 1367
1368 // Query the history to see if the URL being prerendered has ever been 1368 // Query the history to see if the URL being prerendered has ever been
1369 // visited before. 1369 // visited before.
1370 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 1370 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
1371 profile_, Profile::EXPLICIT_ACCESS); 1371 profile_, Profile::EXPLICIT_ACCESS);
1372 if (history_service) { 1372 if (history_service) {
1373 history_service->QueryURL( 1373 history_service->QueryURL(
1374 url, 1374 url,
1375 false, 1375 false,
1376 &query_url_consumer_,
1377 base::Bind(&PrerenderManager::OnHistoryServiceDidQueryURL, 1376 base::Bind(&PrerenderManager::OnHistoryServiceDidQueryURL,
1378 base::Unretained(this), 1377 base::Unretained(this),
1379 origin, 1378 origin,
1380 experiment)); 1379 experiment),
1380 &query_url_tracker_);
1381 } 1381 }
1382 1382
1383 StartSchedulingPeriodicCleanups(); 1383 StartSchedulingPeriodicCleanups();
1384 return prerender_handle; 1384 return prerender_handle;
1385 } 1385 }
1386 1386
1387 void PrerenderManager::StartSchedulingPeriodicCleanups() { 1387 void PrerenderManager::StartSchedulingPeriodicCleanups() {
1388 DCHECK(CalledOnValidThread()); 1388 DCHECK(CalledOnValidThread());
1389 if (repeating_timer_.IsRunning()) 1389 if (repeating_timer_.IsRunning())
1390 return; 1390 return;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 1845
1846 void PrerenderManager::RecordCookieSendType(Origin origin, 1846 void PrerenderManager::RecordCookieSendType(Origin origin,
1847 uint8 experiment_id, 1847 uint8 experiment_id,
1848 int cookie_send_type) const { 1848 int cookie_send_type) const {
1849 histograms_->RecordCookieSendType(origin, experiment_id, cookie_send_type); 1849 histograms_->RecordCookieSendType(origin, experiment_id, cookie_send_type);
1850 } 1850 }
1851 1851
1852 void PrerenderManager::OnHistoryServiceDidQueryURL( 1852 void PrerenderManager::OnHistoryServiceDidQueryURL(
1853 Origin origin, 1853 Origin origin,
1854 uint8 experiment_id, 1854 uint8 experiment_id,
1855 CancelableRequestProvider::Handle handle,
1856 bool success, 1855 bool success,
1857 const history::URLRow* url_row, 1856 const history::URLRow& url_row,
1858 history::VisitVector* visists) { 1857 const history::VisitVector& /*visits*/) {
1859 histograms_->RecordPrerenderPageVisitedStatus(origin, experiment_id, success); 1858 histograms_->RecordPrerenderPageVisitedStatus(origin, experiment_id, success);
1860 } 1859 }
1861 1860
1862 // static 1861 // static
1863 void PrerenderManager::HangSessionStorageMergesForTesting() { 1862 void PrerenderManager::HangSessionStorageMergesForTesting() {
1864 g_hang_session_storage_merges_for_testing = true; 1863 g_hang_session_storage_merges_for_testing = true;
1865 } 1864 }
1866 1865
1867 void PrerenderManager::RecordNetworkBytes(Origin origin, 1866 void PrerenderManager::RecordNetworkBytes(Origin origin,
1868 bool used, 1867 bool used,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 content::RenderProcessHost* host) { 1912 content::RenderProcessHost* host) {
1914 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1915 prerender_process_hosts_.erase(host); 1914 prerender_process_hosts_.erase(host);
1916 BrowserThread::PostTask( 1915 BrowserThread::PostTask(
1917 BrowserThread::IO, FROM_HERE, 1916 BrowserThread::IO, FROM_HERE,
1918 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, 1917 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread,
1919 base::Unretained(prerender_tracker()), host->GetID(), false)); 1918 base::Unretained(prerender_tracker()), host->GetID(), false));
1920 } 1919 }
1921 1920
1922 } // namespace prerender 1921 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698