Chromium Code Reviews| Index: content/browser/tab_contents/render_view_host_manager.cc |
| =================================================================== |
| --- content/browser/tab_contents/render_view_host_manager.cc (revision 118952) |
| +++ content/browser/tab_contents/render_view_host_manager.cc (working copy) |
| @@ -12,7 +12,7 @@ |
| #include "content/browser/renderer_host/render_view_host.h" |
| #include "content/browser/renderer_host/render_view_host_factory.h" |
| #include "content/browser/renderer_host/render_widget_host_view.h" |
| -#include "content/browser/site_instance.h" |
| +#include "content/browser/site_instance_impl.h" |
| #include "content/browser/tab_contents/navigation_controller_impl.h" |
| #include "content/browser/tab_contents/navigation_entry_impl.h" |
| #include "content/browser/webui/web_ui_impl.h" |
| @@ -30,6 +30,7 @@ |
| using content::NavigationController; |
| using content::NavigationEntry; |
| using content::NavigationEntryImpl; |
| +using content::SiteInstance; |
| RenderViewHostManager::RenderViewHostManager( |
| content::RenderViewHostDelegate* render_view_delegate, |
| @@ -66,7 +67,7 @@ |
| // immediately give this SiteInstance to a RenderViewHost so that it is |
| // ref counted. |
| if (!site_instance) |
| - site_instance = SiteInstance::CreateSiteInstance(browser_context); |
| + site_instance = SiteInstance::Create(browser_context); |
| render_view_host_ = RenderViewHostFactory::Create( |
| site_instance, render_view_delegate_, routing_id, delegate_-> |
| GetControllerForRenderManager().GetSessionStorageNamespace()); |
| @@ -345,7 +346,7 @@ |
| // page and one isn't. If there's no cur_entry, check the current RVH's |
| // site, which might already be committed to a Web UI URL (such as the NTP). |
| const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : |
| - render_view_host_->site_instance()->site(); |
| + render_view_host_->site_instance()->GetSite(); |
| content::BrowserContext* browser_context = |
| delegate_->GetControllerForRenderManager().GetBrowserContext(); |
| const content::WebUIFactory* web_ui_factory = |
| @@ -411,21 +412,23 @@ |
| // for this entry. We won't commit the SiteInstance to this site until the |
| // navigation commits (in DidNavigate), unless the navigation entry was |
| // restored or it's a Web UI as described below. |
| - if (!curr_instance->has_site()) { |
| + if (!static_cast<SiteInstanceImpl*>(curr_instance)->HasSite()) { |
|
jam
2012/01/25 02:02:17
nit: to improve readability you might want to cast
ananta
2012/01/25 02:16:29
Done.
|
| // If we've already created a SiteInstance for our destination, we don't |
| // want to use this unused SiteInstance; use the existing one. (We don't |
| // do this check if the curr_instance has a site, because for now, we want |
| // to compare against the current URL and not the SiteInstance's site. In |
| // this case, there is no current URL, so comparing against the site is ok. |
| // See additional comments below.) |
| - if (curr_instance->HasRelatedSiteInstance(dest_url)) |
| + if (static_cast<SiteInstanceImpl*>(curr_instance)->HasRelatedSiteInstance( |
| + dest_url)) |
| return curr_instance->GetRelatedSiteInstance(dest_url); |
| // For extensions, Web UI URLs (such as the new tab page), and apps we do |
| // not want to use the curr_instance if it has no site, since it will have a |
| // RenderProcessHost of PRIV_NORMAL. Create a new SiteInstance for this |
| // URL instead (with the correct process type). |
| - if (curr_instance->HasWrongProcessForURL(dest_url)) |
| + if (static_cast<SiteInstanceImpl*>(curr_instance)->HasWrongProcessForURL( |
| + dest_url)) |
| return curr_instance->GetRelatedSiteInstance(dest_url); |
| // Normally the "site" on the SiteInstance is set lazily when the load |
| @@ -437,7 +440,7 @@ |
| // we need to set the site first, otherwise after a restore none of the |
| // pages would share renderers in process-per-site. |
| if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) |
| - curr_instance->SetSite(dest_url); |
| + static_cast<SiteInstanceImpl*>(curr_instance)->SetSite(dest_url); |
| return curr_instance; |
| } |
| @@ -469,13 +472,14 @@ |
| // the page to a different same-site URL. (This seems very unlikely in |
| // practice.) |
| const GURL& current_url = (curr_entry) ? curr_entry->GetURL() : |
| - curr_instance->site(); |
| + curr_instance->GetSite(); |
| // Use the current SiteInstance for same site navigations, as long as the |
| // process type is correct. (The URL may have been installed as an app since |
| // the last time we visited it.) |
| if (SiteInstance::IsSameWebSite(browser_context, current_url, dest_url) && |
| - !curr_instance->HasWrongProcessForURL(dest_url)) { |
| + !static_cast<SiteInstanceImpl*>(curr_instance)->HasWrongProcessForURL( |
| + dest_url)) { |
| return curr_instance; |
| } else if (ShouldSwapProcessesForNavigation(curr_entry, &entry)) { |
| // When we're swapping, we need to force the site instance AND browsing |
| @@ -484,7 +488,7 @@ |
| // Pages), keeping them in the same process. When you navigate away from |
| // that page, we want to explicity ignore that BrowsingInstance and group |
| // this page into the appropriate SiteInstance for its URL. |
| - return SiteInstance::CreateSiteInstanceForURL(browser_context, dest_url); |
| + return SiteInstance::CreateForURL(browser_context, dest_url); |
| } else { |
| // Start the new renderer in a new SiteInstance, but in the current |
| // BrowsingInstance. It is important to immediately give this new |
| @@ -496,7 +500,7 @@ |
| } |
| bool RenderViewHostManager::CreatePendingRenderView( |
| - const NavigationEntryImpl& entry, SiteInstance* instance) { |
| + const NavigationEntryImpl& entry, SiteInstance* instance) { |
| NavigationEntry* curr_entry = |
| delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); |
| if (curr_entry) { |
| @@ -508,7 +512,7 @@ |
| // Check if we've already created an RVH for this SiteInstance. |
| CHECK(instance); |
| RenderViewHostMap::iterator iter = |
| - swapped_out_hosts_.find(instance->id()); |
| + swapped_out_hosts_.find(instance->GetId()); |
| if (iter != swapped_out_hosts_.end()) { |
| // Re-use the existing RenderViewHost, which has already been initialized. |
| // We'll remove it from the list of swapped out hosts if it commits. |
| @@ -613,7 +617,7 @@ |
| content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details)); |
| // If the pending view was on the swapped out list, we can remove it. |
| - swapped_out_hosts_.erase(render_view_host_->site_instance()->id()); |
| + swapped_out_hosts_.erase(render_view_host_->site_instance()->GetId()); |
| // If the old RVH is live, we are swapping it out and should keep track of it |
| // in case we navigate back to it. |
| @@ -623,7 +627,7 @@ |
| // sure we don't get different rvh instances for the same site instance |
| // in the same rvhmgr. |
| // TODO(creis): Clean this up. |
| - int32 old_site_instance_id = old_render_view_host->site_instance()->id(); |
| + int32 old_site_instance_id = old_render_view_host->site_instance()->GetId(); |
| RenderViewHostMap::iterator iter = |
| swapped_out_hosts_.find(old_site_instance_id); |
| if (iter != swapped_out_hosts_.end() && |
| @@ -815,6 +819,6 @@ |
| if (!rvh->site_instance()) |
| return false; |
| - return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
| + return swapped_out_hosts_.find(rvh->site_instance()->GetId()) != |
| swapped_out_hosts_.end(); |
| } |