Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 987 render_frame_host_->GetSiteInstance()->GetSiteURL(); | 987 render_frame_host_->GetSiteInstance()->GetSiteURL(); |
| 988 bool current_is_view_source_mode = current_entry ? | 988 bool current_is_view_source_mode = current_entry ? |
| 989 current_entry->IsViewSourceMode() : dest_is_view_source_mode; | 989 current_entry->IsViewSourceMode() : dest_is_view_source_mode; |
| 990 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( | 990 bool force_swap = ShouldSwapBrowsingInstancesForNavigation( |
| 991 current_effective_url, | 991 current_effective_url, |
| 992 current_is_view_source_mode, | 992 current_is_view_source_mode, |
| 993 dest_instance, | 993 dest_instance, |
| 994 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), | 994 SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url), |
| 995 dest_is_view_source_mode); | 995 dest_is_view_source_mode); |
| 996 if (ShouldTransitionCrossSite() || force_swap) { | 996 if (ShouldTransitionCrossSite() || force_swap) { |
| 997 new_instance = GetSiteInstanceForURL( | 997 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 998 dest_url, source_instance, current_instance, dest_instance, | 998 switches::kEnableBrowserSideNavigation) && |
| 999 transition, dest_is_restore, dest_is_view_source_mode, force_swap); | 999 speculative_render_frame_host_ && |
| 1000 speculative_render_frame_host_->GetSiteInstance()->GetSiteURL() == | |
| 1001 SiteInstanceImpl::GetSiteForURL(browser_context, dest_url)) { | |
|
Charlie Reis
2015/03/05 04:27:11
SiteInstanceImpl::GetSiteForURL is not equivalent
carlosk
2015/03/06 16:03:54
Acknowledged.
| |
| 1002 // We already created a new SiteInstance for this specific URL during this | |
| 1003 // navigation and used it to create the speculative RenderFrameHost, so | |
| 1004 // there's no need to create yet another new one. | |
| 1005 new_instance = speculative_render_frame_host_->GetSiteInstance(); | |
| 1006 } else { | |
| 1007 new_instance = GetSiteInstanceForURL( | |
| 1008 dest_url, source_instance, current_instance, dest_instance, | |
| 1009 transition, dest_is_restore, dest_is_view_source_mode, force_swap); | |
| 1010 } | |
| 1000 } | 1011 } |
| 1001 | 1012 |
| 1002 // If force_swap is true, we must use a different SiteInstance. If we didn't, | 1013 // If force_swap is true, we must use a different SiteInstance. If we didn't, |
| 1003 // we would have two RenderFrameHosts in the same SiteInstance and the same | 1014 // we would have two RenderFrameHosts in the same SiteInstance and the same |
| 1004 // frame, resulting in page_id conflicts for their NavigationEntries. | 1015 // frame, resulting in page_id conflicts for their NavigationEntries. |
| 1005 if (force_swap) | 1016 if (force_swap) |
| 1006 CHECK_NE(new_instance, current_instance); | 1017 CHECK_NE(new_instance, current_instance); |
| 1007 return new_instance; | 1018 return new_instance; |
| 1008 } | 1019 } |
| 1009 | 1020 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1089 // TODO(nasko): This is the same condition as later in the function. This | 1100 // TODO(nasko): This is the same condition as later in the function. This |
| 1090 // should be taken into account when refactoring this method as part of | 1101 // should be taken into account when refactoring this method as part of |
| 1091 // http://crbug.com/123007. | 1102 // http://crbug.com/123007. |
| 1092 if (dest_is_view_source_mode) | 1103 if (dest_is_view_source_mode) |
| 1093 return SiteInstance::CreateForURL(browser_context, dest_url); | 1104 return SiteInstance::CreateForURL(browser_context, dest_url); |
| 1094 | 1105 |
| 1095 // If we are navigating from a blank SiteInstance to a WebUI, make sure we | 1106 // If we are navigating from a blank SiteInstance to a WebUI, make sure we |
| 1096 // create a new SiteInstance. | 1107 // create a new SiteInstance. |
| 1097 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( | 1108 if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL( |
| 1098 browser_context, dest_url)) { | 1109 browser_context, dest_url)) { |
| 1099 return SiteInstance::CreateForURL(browser_context, dest_url); | 1110 return SiteInstance::CreateForURL(browser_context, dest_url); |
| 1100 } | 1111 } |
| 1101 | 1112 |
| 1102 // Normally the "site" on the SiteInstance is set lazily when the load | 1113 // Normally the "site" on the SiteInstance is set lazily when the load |
| 1103 // actually commits. This is to support better process sharing in case | 1114 // actually commits. This is to support better process sharing in case |
| 1104 // the site redirects to some other site: we want to use the destination | 1115 // the site redirects to some other site: we want to use the destination |
| 1105 // site in the site instance. | 1116 // site in the site instance. |
| 1106 // | 1117 // |
| 1107 // In the case of session restore, as it loads all the pages immediately | 1118 // In the case of session restore, as it loads all the pages immediately |
| 1108 // we need to set the site first, otherwise after a restore none of the | 1119 // we need to set the site first, otherwise after a restore none of the |
| 1109 // pages would share renderers in process-per-site. | 1120 // pages would share renderers in process-per-site. |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1950 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1961 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 1951 SiteInstance* instance) { | 1962 SiteInstance* instance) { |
| 1952 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1963 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 1953 if (iter != proxy_hosts_.end()) { | 1964 if (iter != proxy_hosts_.end()) { |
| 1954 delete iter->second; | 1965 delete iter->second; |
| 1955 proxy_hosts_.erase(iter); | 1966 proxy_hosts_.erase(iter); |
| 1956 } | 1967 } |
| 1957 } | 1968 } |
| 1958 | 1969 |
| 1959 } // namespace content | 1970 } // namespace content |
| OLD | NEW |