| OLD | NEW |
| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 MarkTabContentsAsWouldBePrerendered(tab_contents); | 494 MarkTabContentsAsWouldBePrerendered(tab_contents); |
| 495 return false; | 495 return false; |
| 496 } | 496 } |
| 497 | 497 |
| 498 if (prerender_contents->starting_page_id() <= | 498 if (prerender_contents->starting_page_id() <= |
| 499 tab_contents->GetMaxPageID()) { | 499 tab_contents->GetMaxPageID()) { |
| 500 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); | 500 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); |
| 501 return false; | 501 return false; |
| 502 } | 502 } |
| 503 | 503 |
| 504 // If the prerendered page is in the middle of a cross-site navigation, |
| 505 // don't swap it in because there isn't a good way to merge histories. |
| 506 if (prerender_contents->IsCrossSiteNavigationPending()) { |
| 507 prerender_contents.release()->Destroy( |
| 508 FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING); |
| 509 return false; |
| 510 } |
| 511 |
| 504 int child_id, route_id; | 512 int child_id, route_id; |
| 505 CHECK(prerender_contents->GetChildId(&child_id)); | 513 CHECK(prerender_contents->GetChildId(&child_id)); |
| 506 CHECK(prerender_contents->GetRouteId(&route_id)); | 514 CHECK(prerender_contents->GetRouteId(&route_id)); |
| 507 | 515 |
| 508 // Try to set the prerendered page as used, so any subsequent attempts to | 516 // Try to set the prerendered page as used, so any subsequent attempts to |
| 509 // cancel on other threads will fail. If this fails because the prerender | 517 // cancel on other threads will fail. If this fails because the prerender |
| 510 // was already cancelled, possibly on another thread, fail. | 518 // was already cancelled, possibly on another thread, fail. |
| 511 if (!prerender_tracker_->TryUse(child_id, route_id)) | 519 if (!prerender_tracker_->TryUse(child_id, route_id)) |
| 512 return false; | 520 return false; |
| 513 | 521 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 return last_origin_; | 1108 return last_origin_; |
| 1101 } | 1109 } |
| 1102 | 1110 |
| 1103 bool PrerenderManager::IsOriginExperimentWash() const { | 1111 bool PrerenderManager::IsOriginExperimentWash() const { |
| 1104 if (!WithinWindow()) | 1112 if (!WithinWindow()) |
| 1105 return false; | 1113 return false; |
| 1106 return origin_experiment_wash_; | 1114 return origin_experiment_wash_; |
| 1107 } | 1115 } |
| 1108 | 1116 |
| 1109 } // namespace prerender | 1117 } // namespace prerender |
| OLD | NEW |