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

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

Issue 7550031: Fix cancelling prerenders not being returned by GetAsValue() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 DCHECK(!IsPendingDelete(entry)); 596 DCHECK(!IsPendingDelete(entry));
597 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin(); 597 for (std::list<PrerenderContentsData>::iterator it = prerender_list_.begin();
598 it != prerender_list_.end(); 598 it != prerender_list_.end();
599 ++it) { 599 ++it) {
600 if (it->contents_ == entry) { 600 if (it->contents_ == entry) {
601 RemovePendingPrerender(entry); 601 RemovePendingPrerender(entry);
602 prerender_list_.erase(it); 602 prerender_list_.erase(it);
603 break; 603 break;
604 } 604 }
605 } 605 }
606 AddToHistory(entry);
606 pending_delete_list_.push_back(entry); 607 pending_delete_list_.push_back(entry);
607 608
608 // Destroy the old TabContents relatively promptly to reduce resource usage, 609 // Destroy the old TabContents relatively promptly to reduce resource usage,
609 // and in the case of HTML5 media, reduce the change of playing any sound. 610 // and in the case of HTML5 media, reduce the change of playing any sound.
610 PostCleanupTask(); 611 PostCleanupTask();
611 } 612 }
612 613
613 base::Time PrerenderManager::GetCurrentTime() const { 614 base::Time PrerenderManager::GetCurrentTime() const {
614 return base::Time::Now(); 615 return base::Time::Now();
615 } 616 }
(...skipping 28 matching lines...) Expand all
644 return true; 645 return true;
645 } 646 }
646 647
647 return false; 648 return false;
648 } 649 }
649 650
650 void PrerenderManager::DeletePendingDeleteEntries() { 651 void PrerenderManager::DeletePendingDeleteEntries() {
651 while (!pending_delete_list_.empty()) { 652 while (!pending_delete_list_.empty()) {
652 PrerenderContents* contents = pending_delete_list_.front(); 653 PrerenderContents* contents = pending_delete_list_.front();
653 pending_delete_list_.pop_front(); 654 pending_delete_list_.pop_front();
654 AddToHistory(contents);
655 delete contents; 655 delete contents;
656 } 656 }
657 } 657 }
658 658
659 // Helper macro for histograms. 659 // Helper macro for histograms.
660 #define RECORD_PLT(tag, perceived_page_load_time) { \ 660 #define RECORD_PLT(tag, perceived_page_load_time) { \
661 PREFIXED_HISTOGRAM_PRERENDER_MANAGER(prerender_manager, \ 661 PREFIXED_HISTOGRAM_PRERENDER_MANAGER(prerender_manager, \
662 UMA_HISTOGRAM_CUSTOM_TIMES( \ 662 UMA_HISTOGRAM_CUSTOM_TIMES( \
663 base::FieldTrial::MakeName( \ 663 base::FieldTrial::MakeName( \
664 prerender_manager->GetDefaultHistogramName(tag), "Prefetch"), \ 664 prerender_manager->GetDefaultHistogramName(tag), "Prefetch"), \
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 return last_origin_; 1100 return last_origin_;
1101 } 1101 }
1102 1102
1103 bool PrerenderManager::IsOriginExperimentWash() const { 1103 bool PrerenderManager::IsOriginExperimentWash() const {
1104 if (!WithinWindow()) 1104 if (!WithinWindow())
1105 return false; 1105 return false;
1106 return origin_experiment_wash_; 1106 return origin_experiment_wash_;
1107 } 1107 }
1108 1108
1109 } // namespace prerender 1109 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698