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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 if (prerender_contents.get() == NULL) | 537 if (prerender_contents.get() == NULL) |
538 return false; | 538 return false; |
539 | 539 |
540 // Do not use the prerendered version if the opener window.property was | 540 // Do not use the prerendered version if the opener window.property was |
541 // supposed to be set. | 541 // supposed to be set. |
542 if (has_opener_set) { | 542 if (has_opener_set) { |
543 prerender_contents.release()->Destroy(FINAL_STATUS_WINDOW_OPENER); | 543 prerender_contents.release()->Destroy(FINAL_STATUS_WINDOW_OPENER); |
544 return false; | 544 return false; |
545 } | 545 } |
546 | 546 |
| 547 if (prerender_contents->starting_page_id() <= |
| 548 tab_contents->GetMaxPageID()) { |
| 549 prerender_contents.release()->Destroy(FINAL_STATUS_PAGE_ID_CONFLICT); |
| 550 return false; |
| 551 } |
| 552 |
547 // If we are just in the control group (which can be detected by noticing | 553 // If we are just in the control group (which can be detected by noticing |
548 // that prerendering hasn't even started yet), record that |tab_contents| now | 554 // that prerendering hasn't even started yet), record that |tab_contents| now |
549 // would be showing a prerendered contents, but otherwise, don't do anything. | 555 // would be showing a prerendered contents, but otherwise, don't do anything. |
550 if (!prerender_contents->prerendering_has_started()) { | 556 if (!prerender_contents->prerendering_has_started()) { |
551 MarkTabContentsAsWouldBePrerendered(tab_contents); | 557 MarkTabContentsAsWouldBePrerendered(tab_contents); |
552 return false; | 558 return false; |
553 } | 559 } |
554 | 560 |
555 int child_id, route_id; | 561 int child_id, route_id; |
556 CHECK(prerender_contents->GetChildId(&child_id)); | 562 CHECK(prerender_contents->GetChildId(&child_id)); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 base::TimeTicks cutoff = GetCurrentTimeTicks() - | 1000 base::TimeTicks cutoff = GetCurrentTimeTicks() - |
995 base::TimeDelta::FromMilliseconds(kNavigationRecordWindowMs); | 1001 base::TimeDelta::FromMilliseconds(kNavigationRecordWindowMs); |
996 while (!navigations_.empty()) { | 1002 while (!navigations_.empty()) { |
997 if (navigations_.front().time_ > cutoff) | 1003 if (navigations_.front().time_ > cutoff) |
998 break; | 1004 break; |
999 navigations_.pop_front(); | 1005 navigations_.pop_front(); |
1000 } | 1006 } |
1001 } | 1007 } |
1002 | 1008 |
1003 } // namespace prerender | 1009 } // namespace prerender |
OLD | NEW |