| OLD | NEW |
| 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 Loading... |
| 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_, |
| 1376 base::Bind(&PrerenderManager::OnHistoryServiceDidQueryURL, | 1377 base::Bind(&PrerenderManager::OnHistoryServiceDidQueryURL, |
| 1377 base::Unretained(this), | 1378 base::Unretained(this), |
| 1378 origin, | 1379 origin, |
| 1379 experiment), | 1380 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 Loading... |
| 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, |
| 1855 bool success, | 1856 bool success, |
| 1856 const history::URLRow& url_row, | 1857 const history::URLRow* url_row, |
| 1857 const history::VisitVector& /*visits*/) { | 1858 history::VisitVector* visists) { |
| 1858 histograms_->RecordPrerenderPageVisitedStatus(origin, experiment_id, success); | 1859 histograms_->RecordPrerenderPageVisitedStatus(origin, experiment_id, success); |
| 1859 } | 1860 } |
| 1860 | 1861 |
| 1861 // static | 1862 // static |
| 1862 void PrerenderManager::HangSessionStorageMergesForTesting() { | 1863 void PrerenderManager::HangSessionStorageMergesForTesting() { |
| 1863 g_hang_session_storage_merges_for_testing = true; | 1864 g_hang_session_storage_merges_for_testing = true; |
| 1864 } | 1865 } |
| 1865 | 1866 |
| 1866 void PrerenderManager::RecordNetworkBytes(Origin origin, | 1867 void PrerenderManager::RecordNetworkBytes(Origin origin, |
| 1867 bool used, | 1868 bool used, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 content::RenderProcessHost* host) { | 1913 content::RenderProcessHost* host) { |
| 1913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1914 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1914 prerender_process_hosts_.erase(host); | 1915 prerender_process_hosts_.erase(host); |
| 1915 BrowserThread::PostTask( | 1916 BrowserThread::PostTask( |
| 1916 BrowserThread::IO, FROM_HERE, | 1917 BrowserThread::IO, FROM_HERE, |
| 1917 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, | 1918 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, |
| 1918 base::Unretained(prerender_tracker()), host->GetID(), false)); | 1919 base::Unretained(prerender_tracker()), host->GetID(), false)); |
| 1919 } | 1920 } |
| 1920 | 1921 |
| 1921 } // namespace prerender | 1922 } // namespace prerender |
| OLD | NEW |