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

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

Issue 7015026: Cancel prerenders for pages that call window.print() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment responses. Created 9 years, 7 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) 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/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 if (has_child_id && has_route_id && 353 if (has_child_id && has_route_id &&
354 child_id == child_route_id_pair.first && 354 child_id == child_route_id_pair.first &&
355 route_id == child_route_id_pair.second) { 355 route_id == child_route_id_pair.second) {
356 break; 356 break;
357 } 357 }
358 } 358 }
359 return it; 359 return it;
360 } 360 }
361 361
362 void PrerenderManager::DestroyPreloadForChildRouteIdPair( 362 bool PrerenderManager::DestroyPreloadForChildRouteIdPair(
363 const std::pair<int, int>& child_route_id_pair, 363 const std::pair<int, int>& child_route_id_pair,
364 FinalStatus final_status) { 364 FinalStatus final_status) {
365 DCHECK(CalledOnValidThread()); 365 DCHECK(CalledOnValidThread());
366 std::list<PrerenderContentsData>::iterator it = 366 std::list<PrerenderContentsData>::iterator it =
367 FindPrerenderContentsForChildRouteIdPair(child_route_id_pair); 367 FindPrerenderContentsForChildRouteIdPair(child_route_id_pair);
368 if (it != prerender_list_.end()) { 368 if (it != prerender_list_.end()) {
369 PrerenderContents* prerender_contents = it->contents_; 369 PrerenderContents* prerender_contents = it->contents_;
370 prerender_contents->Destroy(final_status); 370 prerender_contents->Destroy(final_status);
371 return true;
371 } 372 }
373 return false;
372 } 374 }
373 375
374 void PrerenderManager::DeleteOldEntries() { 376 void PrerenderManager::DeleteOldEntries() {
375 DCHECK(CalledOnValidThread()); 377 DCHECK(CalledOnValidThread());
376 while (!prerender_list_.empty()) { 378 while (!prerender_list_.empty()) {
377 PrerenderContentsData data = prerender_list_.front(); 379 PrerenderContentsData data = prerender_list_.front();
378 if (IsPrerenderElementFresh(data.start_time_)) 380 if (IsPrerenderElementFresh(data.start_time_))
379 return; 381 return;
380 prerender_list_.pop_front(); 382 prerender_list_.pop_front();
381 data.contents_->set_final_status(FINAL_STATUS_TIMED_OUT); 383 data.contents_->set_final_status(FINAL_STATUS_TIMED_OUT);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return prerendered_tab_contents_set_.count(tab_contents) > 0; 903 return prerendered_tab_contents_set_.count(tab_contents) > 0;
902 } 904 }
903 905
904 bool PrerenderManager::WouldTabContentsBePrerendered( 906 bool PrerenderManager::WouldTabContentsBePrerendered(
905 TabContents* tab_contents) const { 907 TabContents* tab_contents) const {
906 DCHECK(CalledOnValidThread()); 908 DCHECK(CalledOnValidThread());
907 return would_be_prerendered_tab_contents_set_.count(tab_contents) > 0; 909 return would_be_prerendered_tab_contents_set_.count(tab_contents) > 0;
908 } 910 }
909 911
910 } // namespace prerender 912 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698