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

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

Issue 330063004: Various Prerender Service / Prerender LocalPredictor related changes. (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/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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 return active_prerenders_.end(); 1526 return active_prerenders_.end();
1527 } 1527 }
1528 1528
1529 bool PrerenderManager::DoesRateLimitAllowPrerender(Origin origin) const { 1529 bool PrerenderManager::DoesRateLimitAllowPrerender(Origin origin) const {
1530 DCHECK(CalledOnValidThread()); 1530 DCHECK(CalledOnValidThread());
1531 base::TimeDelta elapsed_time = 1531 base::TimeDelta elapsed_time =
1532 GetCurrentTimeTicks() - last_prerender_start_time_; 1532 GetCurrentTimeTicks() - last_prerender_start_time_;
1533 histograms_->RecordTimeBetweenPrerenderRequests(origin, elapsed_time); 1533 histograms_->RecordTimeBetweenPrerenderRequests(origin, elapsed_time);
1534 if (!config_.rate_limit_enabled) 1534 if (!config_.rate_limit_enabled)
1535 return true; 1535 return true;
1536 if (origin == ORIGIN_LOCAL_PREDICTOR)
davidben 2014/06/19 19:33:34 Nit: Add a comment that ORIGIN_LOCAL_PREDICTOR may
tburkard 2014/06/19 20:01:49 Done.
1537 return true;
1536 return elapsed_time >= 1538 return elapsed_time >=
1537 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs); 1539 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs);
1538 } 1540 }
1539 1541
1540 void PrerenderManager::DeleteOldWebContents() { 1542 void PrerenderManager::DeleteOldWebContents() {
1541 while (!old_web_contents_list_.empty()) { 1543 while (!old_web_contents_list_.empty()) {
1542 WebContents* web_contents = old_web_contents_list_.front(); 1544 WebContents* web_contents = old_web_contents_list_.front();
1543 old_web_contents_list_.pop_front(); 1545 old_web_contents_list_.pop_front();
1544 // TODO(dominich): should we use Instant Unload Handler here? 1546 // TODO(dominich): should we use Instant Unload Handler here?
1545 delete web_contents; 1547 delete web_contents;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 content::RenderProcessHost* host) { 1914 content::RenderProcessHost* host) {
1913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1915 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1914 prerender_process_hosts_.erase(host); 1916 prerender_process_hosts_.erase(host);
1915 BrowserThread::PostTask( 1917 BrowserThread::PostTask(
1916 BrowserThread::IO, FROM_HERE, 1918 BrowserThread::IO, FROM_HERE,
1917 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, 1919 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread,
1918 base::Unretained(prerender_tracker()), host->GetID(), false)); 1920 base::Unretained(prerender_tracker()), host->GetID(), false));
1919 } 1921 }
1920 1922
1921 } // namespace prerender 1923 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698