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

Unified Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 9146028: Define the public interface for content browser SiteInstance. This interface is implemented by th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/tab_contents/render_view_host_manager.cc
===================================================================
--- content/browser/tab_contents/render_view_host_manager.cc (revision 118703)
+++ 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"
@@ -60,13 +60,14 @@
}
void RenderViewHostManager::Init(content::BrowserContext* browser_context,
- SiteInstance* site_instance,
+ content::SiteInstance* site_instance,
int routing_id) {
// Create a RenderViewHost, once we have an instance. It is important to
// immediately give this SiteInstance to a RenderViewHost so that it is
// ref counted.
if (!site_instance)
- site_instance = SiteInstance::CreateSiteInstance(browser_context);
+ site_instance = content::SiteInstance::CreateSiteInstance(
+ 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 =
@@ -379,9 +380,9 @@
return false;
}
-SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
+content::SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
const NavigationEntryImpl& entry,
- SiteInstance* curr_instance) {
+ content::SiteInstance* curr_instance) {
// NOTE: This is only called when ShouldTransitionCrossSite is true.
const GURL& dest_url = entry.GetURL();
@@ -411,7 +412,7 @@
// 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 (!curr_instance->HasSite()) {
// 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
@@ -469,12 +470,13 @@
// 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) &&
+ if (content::SiteInstance::IsSameWebSite(
+ browser_context, current_url, dest_url) &&
!curr_instance->HasWrongProcessForURL(dest_url)) {
return curr_instance;
} else if (ShouldSwapProcessesForNavigation(curr_entry, &entry)) {
@@ -484,7 +486,8 @@
// 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 content::SiteInstance::CreateSiteInstanceForURL(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 +499,7 @@
}
bool RenderViewHostManager::CreatePendingRenderView(
- const NavigationEntryImpl& entry, SiteInstance* instance) {
+ const NavigationEntryImpl& entry, content::SiteInstance* instance) {
NavigationEntry* curr_entry =
delegate_->GetControllerForRenderManager().GetLastCommittedEntry();
if (curr_entry) {
@@ -508,7 +511,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 +616,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 +626,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() &&
@@ -661,12 +664,12 @@
// render_view_host_ will not be deleted before the end of this method, so we
// don't have to worry about this SiteInstance's ref count dropping to zero.
- SiteInstance* curr_instance = render_view_host_->site_instance();
+ content::SiteInstance* curr_instance = render_view_host_->site_instance();
// Determine if we need a new SiteInstance for this entry.
// Again, new_instance won't be deleted before the end of this method, so it
// is safe to use a normal pointer here.
- SiteInstance* new_instance = curr_instance;
+ content::SiteInstance* new_instance = curr_instance;
bool force_swap = ShouldSwapProcessesForNavigation(
delegate_->GetLastCommittedNavigationEntryForRenderManager(), &entry);
if (ShouldTransitionCrossSite() || force_swap)
@@ -815,6 +818,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();
}

Powered by Google App Engine
This is Rietveld 408576698