Chromium Code Reviews| Index: content/browser/frame_host/navigation_request.cc |
| diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
| index 95bc35fb3f83407c51ba0257e2780d0dfe8694d3..5ed66ed0fc29f4af4d993bb2a3ccba815cb9e8fa 100644 |
| --- a/content/browser/frame_host/navigation_request.cc |
| +++ b/content/browser/frame_host/navigation_request.cc |
| @@ -553,6 +553,18 @@ void NavigationRequest::OnRequestRedirected( |
| } |
| } |
| + // Compute the SiteInstance to use for the redirect and pass its |
| + // RenderProcessHost if it has a process. Keep a reference if it has a |
| + // process, so that the SiteInstance and its associated process aren't deleted |
| + // before the navigation is ready to commit. |
| + scoped_refptr<SiteInstance> site_instance = |
| + frame_tree_node_->render_manager()->GetSiteInstanceForNavigationRequest( |
| + *this); |
| + RenderProcessHost* expected_process = |
| + site_instance->HasProcess() ? site_instance->GetProcess() : nullptr; |
| + speculative_site_instance_ = |
| + site_instance->HasProcess() ? site_instance : nullptr; |
|
clamy
2017/06/27 16:43:32
Note: I'm not storing the SiteInstance if its proc
Charlie Reis
2017/06/27 18:46:34
Acknowledged.
|
| + |
| // It's safe to use base::Unretained because this NavigationRequest owns the |
| // NavigationHandle where the callback will be stored. |
| bool is_external_protocol = |
| @@ -560,7 +572,7 @@ void NavigationRequest::OnRequestRedirected( |
| navigation_handle_->WillRedirectRequest( |
| common_params_.url, common_params_.method, common_params_.referrer.url, |
| is_external_protocol, response->head.headers, |
| - response->head.connection_info, |
| + response->head.connection_info, expected_process, |
| base::Bind(&NavigationRequest::OnRedirectChecksComplete, |
| base::Unretained(this))); |
| } |