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

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

Issue 565263005: Remove the use of ProvisionalChangeToMainFrameUrl from prerender code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@redirsupervised
Patch Set: test Created 6 years, 3 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "chrome/common/prerender_messages.h" 48 #include "chrome/common/prerender_messages.h"
49 #include "chrome/common/prerender_types.h" 49 #include "chrome/common/prerender_types.h"
50 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
51 #include "content/public/browser/devtools_agent_host.h" 51 #include "content/public/browser/devtools_agent_host.h"
52 #include "content/public/browser/navigation_controller.h" 52 #include "content/public/browser/navigation_controller.h"
53 #include "content/public/browser/notification_service.h" 53 #include "content/public/browser/notification_service.h"
54 #include "content/public/browser/notification_source.h" 54 #include "content/public/browser/notification_source.h"
55 #include "content/public/browser/render_frame_host.h" 55 #include "content/public/browser/render_frame_host.h"
56 #include "content/public/browser/render_process_host.h" 56 #include "content/public/browser/render_process_host.h"
57 #include "content/public/browser/render_view_host.h" 57 #include "content/public/browser/render_view_host.h"
58 #include "content/public/browser/resource_request_details.h"
58 #include "content/public/browser/session_storage_namespace.h" 59 #include "content/public/browser/session_storage_namespace.h"
59 #include "content/public/browser/site_instance.h" 60 #include "content/public/browser/site_instance.h"
60 #include "content/public/browser/storage_partition.h" 61 #include "content/public/browser/storage_partition.h"
61 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
62 #include "content/public/browser/web_contents_delegate.h" 63 #include "content/public/browser/web_contents_delegate.h"
63 #include "content/public/common/url_constants.h" 64 #include "content/public/common/url_constants.h"
64 #include "extensions/common/constants.h" 65 #include "extensions/common/constants.h"
65 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 66 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
66 #include "net/url_request/url_request_context.h" 67 #include "net/url_request/url_request_context.h"
67 #include "net/url_request/url_request_context_getter.h" 68 #include "net/url_request/url_request_context_getter.h"
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 } 1087 }
1087 1088
1088 seen_target_route_id_ = true; 1089 seen_target_route_id_ = true;
1089 target_route_id_ = PrerenderTracker::ChildRouteIdPair( 1090 target_route_id_ = PrerenderTracker::ChildRouteIdPair(
1090 render_view_host->GetMainFrame()->GetProcess()->GetID(), 1091 render_view_host->GetMainFrame()->GetProcess()->GetID(),
1091 render_view_host->GetMainFrame()->GetRoutingID()); 1092 render_view_host->GetMainFrame()->GetRoutingID());
1092 manager_->prerender_tracker()->AddPrerenderPendingSwap( 1093 manager_->prerender_tracker()->AddPrerenderPendingSwap(
1093 target_route_id_, url_); 1094 target_route_id_, url_);
1094 } 1095 }
1095 1096
1096 void PrerenderManager::PendingSwap::ProvisionalChangeToMainFrameUrl( 1097 void PrerenderManager::PendingSwap::DidGetRedirectForResourceRequest(
1097 const GURL& url, 1098 RenderViewHost* render_view_host,
1098 content::RenderFrameHost* render_frame_host) { 1099 const content::ResourceRedirectDetails& details) {
1099 // We must only cancel the pending swap if the |url| navigated to is not 1100 if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME)
cbentzel 2014/09/16 00:33:41 This is coming at a pretty different time for Prov
Avi (use Gerrit) 2014/09/16 21:03:08 Acknowledged.
1101 return;
1102
1103 // We must only cancel the pending swap if the url navigated to is not
1100 // the URL being attempted to be swapped in. That's because in the normal 1104 // the URL being attempted to be swapped in. That's because in the normal
1101 // flow, a ProvisionalChangeToMainFrameUrl will happen for the URL attempted 1105 // flow, a ProvisionalChangeToMainFrameUrl will happen for the URL attempted
1102 // to be swapped in immediately after the pending swap has issued its merge. 1106 // to be swapped in immediately after the pending swap has issued its merge.
1103 if (url != url_) 1107 if (details.new_url != url_)
1104 prerender_data_->ClearPendingSwap(); 1108 prerender_data_->ClearPendingSwap();
1105 } 1109 }
1106 1110
1107 void PrerenderManager::PendingSwap::DidCommitProvisionalLoadForFrame( 1111 void PrerenderManager::PendingSwap::DidCommitProvisionalLoadForFrame(
1108 content::RenderFrameHost* render_frame_host, 1112 content::RenderFrameHost* render_frame_host,
1109 const GURL& validated_url, 1113 const GURL& validated_url,
1110 content::PageTransition transition_type) { 1114 content::PageTransition transition_type) {
1111 if (render_frame_host->GetParent()) 1115 if (render_frame_host->GetParent())
1112 return; 1116 return;
1113 prerender_data_->ClearPendingSwap(); 1117 prerender_data_->ClearPendingSwap();
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 content::RenderProcessHost* host) { 1889 content::RenderProcessHost* host) {
1886 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1890 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1887 prerender_process_hosts_.erase(host); 1891 prerender_process_hosts_.erase(host);
1888 BrowserThread::PostTask( 1892 BrowserThread::PostTask(
1889 BrowserThread::IO, FROM_HERE, 1893 BrowserThread::IO, FROM_HERE,
1890 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread, 1894 base::Bind(&PrerenderTracker::RemovePrerenderCookieStoreOnIOThread,
1891 base::Unretained(prerender_tracker()), host->GetID(), false)); 1895 base::Unretained(prerender_tracker()), host->GetID(), false));
1892 } 1896 }
1893 1897
1894 } // namespace prerender 1898 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698