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

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

Issue 7649009: Merge of 97624 to 835 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/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
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 MarkTabContentsAsWouldBePrerendered(tab_contents); 491 MarkTabContentsAsWouldBePrerendered(tab_contents);
492 return false; 492 return false;
493 } 493 }
494 494
495 if (prerender_contents->starting_page_id() <= 495 if (prerender_contents->starting_page_id() <=
496 tab_contents->GetMaxPageID()) { 496 tab_contents->GetMaxPageID()) {
497 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); 497 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT);
498 return false; 498 return false;
499 } 499 }
500 500
501 // If the prerendered page is in the middle of a cross-site navigation,
502 // don't swap it in because there isn't a good way to merge histories.
503 if (prerender_contents->IsCrossSiteNavigationPending()) {
504 prerender_contents.release()->Destroy(
505 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING);
506 return false;
507 }
508
501 int child_id, route_id; 509 int child_id, route_id;
502 CHECK(prerender_contents->GetChildId(&child_id)); 510 CHECK(prerender_contents->GetChildId(&child_id));
503 CHECK(prerender_contents->GetRouteId(&route_id)); 511 CHECK(prerender_contents->GetRouteId(&route_id));
504 512
505 // Try to set the prerendered page as used, so any subsequent attempts to 513 // Try to set the prerendered page as used, so any subsequent attempts to
506 // cancel on other threads will fail. If this fails because the prerender 514 // cancel on other threads will fail. If this fails because the prerender
507 // was already cancelled, possibly on another thread, fail. 515 // was already cancelled, possibly on another thread, fail.
508 if (!prerender_tracker_->TryUse(child_id, route_id)) 516 if (!prerender_tracker_->TryUse(child_id, route_id))
509 return false; 517 return false;
510 518
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 return last_origin_; 1090 return last_origin_;
1083 } 1091 }
1084 1092
1085 bool PrerenderManager::IsOriginExperimentWash() const { 1093 bool PrerenderManager::IsOriginExperimentWash() const {
1086 if (!WithinWindow()) 1094 if (!WithinWindow())
1087 return false; 1095 return false;
1088 return origin_experiment_wash_; 1096 return origin_experiment_wash_;
1089 } 1097 }
1090 1098
1091 } // namespace prerender 1099 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_final_status.cc ('k') | chrome/browser/tab_contents/web_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698