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

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

Issue 212703005: Preserve Page::openedByDOM state across process swaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tie opened_by_dom with opener. Created 6 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // there is a pending entry, it may not commit. 522 // there is a pending entry, it may not commit.
523 // TODO(creis): If there is a pending navigation and no last committed 523 // TODO(creis): If there is a pending navigation and no last committed
524 // entry, we might be able to transfer the network request instead. 524 // entry, we might be able to transfer the network request instead.
525 if (!new_web_contents->GetController().CanPruneAllButLastCommitted()) { 525 if (!new_web_contents->GetController().CanPruneAllButLastCommitted()) {
526 // Abort this prerender so it is not used later. http://crbug.com/292121 526 // Abort this prerender so it is not used later. http://crbug.com/292121
527 prerender_data->contents()->Destroy(FINAL_STATUS_NAVIGATION_UNCOMMITTED); 527 prerender_data->contents()->Destroy(FINAL_STATUS_NAVIGATION_UNCOMMITTED);
528 return NULL; 528 return NULL;
529 } 529 }
530 } 530 }
531 531
532 // Do not use the prerendered version if there is an opener object. 532 // Do not use the prerendered version if the target WebContents has an opener
533 if (web_contents->HasOpener()) { 533 // or was created with one. The latter controls whether window.close() is
534 // allowed, so the behavior is observable.
535 if (web_contents->CreatedWithOpener()) {
Charlie Reis 2014/04/05 01:41:25 Unfortunately, using the opener for this was the w
davidben 2014/04/07 17:57:52 Hrm, yeah, I'd been wondering if the opener check
534 prerender_data->contents()->Destroy(FINAL_STATUS_WINDOW_OPENER); 536 prerender_data->contents()->Destroy(FINAL_STATUS_WINDOW_OPENER);
535 return NULL; 537 return NULL;
536 } 538 }
537 539
538 // Do not swap in the prerender if the current WebContents is being captured. 540 // Do not swap in the prerender if the current WebContents is being captured.
539 if (web_contents->GetCapturerCount() > 0) { 541 if (web_contents->GetCapturerCount() > 0) {
540 prerender_data->contents()->Destroy(FINAL_STATUS_PAGE_BEING_CAPTURED); 542 prerender_data->contents()->Destroy(FINAL_STATUS_PAGE_BEING_CAPTURED);
541 return NULL; 543 return NULL;
542 } 544 }
543 545
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 histograms_->RecordNetworkBytes(used, prerender_bytes, recent_profile_bytes); 1825 histograms_->RecordNetworkBytes(used, prerender_bytes, recent_profile_bytes);
1824 } 1826 }
1825 1827
1826 void PrerenderManager::AddProfileNetworkBytesIfEnabled(int64 bytes) { 1828 void PrerenderManager::AddProfileNetworkBytesIfEnabled(int64 bytes) {
1827 DCHECK_GE(bytes, 0); 1829 DCHECK_GE(bytes, 0);
1828 if (IsEnabled() && ActuallyPrerendering()) 1830 if (IsEnabled() && ActuallyPrerendering())
1829 profile_network_bytes_ += bytes; 1831 profile_network_bytes_ += bytes;
1830 } 1832 }
1831 1833
1832 } // namespace prerender 1834 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698