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

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

Issue 550453002: Avoid doing periodic prerender cleanup when there are no contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests Created 6 years, 3 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 // If this PrerenderContents is being deleted due to a cancellation any time 684 // If this PrerenderContents is being deleted due to a cancellation any time
685 // after the prerender has started then we need to create a dummy replacement 685 // after the prerender has started then we need to create a dummy replacement
686 // for PPLT accounting purposes for the Match Complete group. This is the case 686 // for PPLT accounting purposes for the Match Complete group. This is the case
687 // if the cancellation is for any reason that would not occur in the control 687 // if the cancellation is for any reason that would not occur in the control
688 // group case. 688 // group case.
689 if (entry->prerendering_has_started() && 689 if (entry->prerendering_has_started() &&
690 entry->match_complete_status() == 690 entry->match_complete_status() ==
691 PrerenderContents::MATCH_COMPLETE_DEFAULT && 691 PrerenderContents::MATCH_COMPLETE_DEFAULT &&
692 NeedMatchCompleteDummyForFinalStatus(final_status) && 692 NeedMatchCompleteDummyForFinalStatus(final_status) &&
693 ActuallyPrerendering()) { 693 ActuallyPrerendering() &&
694 GetMode() == PRERENDER_MODE_EXPERIMENT_MATCH_COMPLETE_GROUP) {
694 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering. 695 // TODO(tburkard): I'd like to DCHECK that we are actually prerendering.
695 // However, what if new conditions are added and 696 // However, what if new conditions are added and
696 // NeedMatchCompleteDummyForFinalStatus is not being updated. Not sure 697 // NeedMatchCompleteDummyForFinalStatus is not being updated. Not sure
697 // what's the best thing to do here. For now, I will just check whether 698 // what's the best thing to do here. For now, I will just check whether
698 // we are actually prerendering. 699 // we are actually prerendering.
699 (*it)->MakeIntoMatchCompleteReplacement(); 700 (*it)->MakeIntoMatchCompleteReplacement();
700 } else { 701 } else {
701 to_delete_prerenders_.push_back(*it); 702 to_delete_prerenders_.push_back(*it);
702 (*it)->ClearPendingSwap(); 703 (*it)->ClearPendingSwap();
703 active_prerenders_.weak_erase(it); 704 active_prerenders_.weak_erase(it);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 case PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP: 757 case PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP:
757 return "_Enabled"; 758 return "_Enabled";
758 case PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP: 759 case PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP:
759 return "_Control"; 760 return "_Control";
760 case PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP: 761 case PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP:
761 return "_Multi"; 762 return "_Multi";
762 case PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP: 763 case PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP:
763 return "_15MinTTL"; 764 return "_15MinTTL";
764 case PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP: 765 case PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP:
765 return "_NoUse"; 766 return "_NoUse";
767 case PRERENDER_MODE_EXPERIMENT_MATCH_COMPLETE_GROUP:
768 return "_MatchComplete";
766 case PRERENDER_MODE_MAX: 769 case PRERENDER_MODE_MAX:
767 default: 770 default:
768 NOTREACHED() << "Invalid PrerenderManager mode."; 771 NOTREACHED() << "Invalid PrerenderManager mode.";
769 break; 772 break;
770 } 773 }
771 return ""; 774 return "";
772 } 775 }
773 776
774 // static 777 // static
775 bool PrerenderManager::IsPrerenderingPossible() { 778 bool PrerenderManager::IsPrerenderingPossible() {
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 content::RenderProcessHost* host) { 1888 content::RenderProcessHost* host) {
1886 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1889 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1887 prerender_process_hosts_.erase(host); 1890 prerender_process_hosts_.erase(host);
1888 BrowserThread::PostTask( 1891 BrowserThread::PostTask(
1889 BrowserThread::IO, FROM_HERE, 1892 BrowserThread::IO, FROM_HERE,
1890 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, 1893 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread,
1891 base::Unretained(prerender_tracker()), host->GetID(), false)); 1894 base::Unretained(prerender_tracker()), host->GetID(), false));
1892 } 1895 }
1893 1896
1894 } // namespace prerender 1897 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698