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

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: davidben feedback 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 // The LocalPredictor may issue multiple prerenders simultaneously (if so
1537 // configured), so no throttling.
1538 if (origin == ORIGIN_LOCAL_PREDICTOR)
1539 return true;
1536 return elapsed_time >= 1540 return elapsed_time >=
1537 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs); 1541 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs);
1538 } 1542 }
1539 1543
1540 void PrerenderManager::DeleteOldWebContents() { 1544 void PrerenderManager::DeleteOldWebContents() {
1541 while (!old_web_contents_list_.empty()) { 1545 while (!old_web_contents_list_.empty()) {
1542 WebContents* web_contents = old_web_contents_list_.front(); 1546 WebContents* web_contents = old_web_contents_list_.front();
1543 old_web_contents_list_.pop_front(); 1547 old_web_contents_list_.pop_front();
1544 // TODO(dominich): should we use Instant Unload Handler here? 1548 // TODO(dominich): should we use Instant Unload Handler here?
1545 delete web_contents; 1549 delete web_contents;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 content::RenderProcessHost* host) { 1916 content::RenderProcessHost* host) {
1913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1917 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1914 prerender_process_hosts_.erase(host); 1918 prerender_process_hosts_.erase(host);
1915 BrowserThread::PostTask( 1919 BrowserThread::PostTask(
1916 BrowserThread::IO, FROM_HERE, 1920 BrowserThread::IO, FROM_HERE,
1917 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, 1921 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread,
1918 base::Unretained(prerender_tracker()), host->GetID(), false)); 1922 base::Unretained(prerender_tracker()), host->GetID(), false));
1919 } 1923 }
1920 1924
1921 } // namespace prerender 1925 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698