Move StoragePartition into content/public and remove BrowserContext::GetDOMStorageContext().
Eventually all the storage context accessors will be removed from BrowserContext. Instead, users should retrieve the storage context from the StoragePartition.
This also changes RenderProcessHost to take in a StoragePartition removing the need for a re-lookup its storage contexts.
BUG=85121,143486
Review URL: https://chromiumcodereview.appspot.com/10837230
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152251 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index bded9020..d8fcd0e 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -8,6 +8,7 @@
#include "content/browser/browsing_instance.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
+#include "content/browser/storage_partition_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -17,9 +18,11 @@
#include "content/public/common/url_constants.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+using content::BrowserContext;
using content::RenderProcessHost;
using content::RenderProcessHostImpl;
using content::SiteInstance;
+using content::StoragePartitionImpl;
using content::WebUIControllerFactory;
static bool IsURLSameAsAnySiteInstance(const GURL& url) {
@@ -93,8 +96,7 @@
// Create a new process if ours went away or was reused.
if (!process_) {
- content::BrowserContext* browser_context =
- browsing_instance_->browser_context();
+ BrowserContext* browser_context = browsing_instance_->browser_context();
// If we should use process-per-site mode (either in general or for the
// given site), then look for an existing RenderProcessHost for the site.
@@ -118,8 +120,11 @@
process_ = render_process_host_factory_->CreateRenderProcessHost(
browser_context);
} else {
+ StoragePartitionImpl* partition =
+ static_cast<StoragePartitionImpl*>(
+ BrowserContext::GetStoragePartition(browser_context, this));
process_ =
- new RenderProcessHostImpl(browser_context,
+ new RenderProcessHostImpl(browser_context, partition,
site_.SchemeIs(chrome::kGuestScheme));
}
}
@@ -154,8 +159,7 @@
// Remember that this SiteInstance has been used to load a URL, even if the
// URL is invalid.
has_site_ = true;
- content::BrowserContext* browser_context =
- browsing_instance_->browser_context();
+ BrowserContext* browser_context = browsing_instance_->browser_context();
site_ = GetSiteForURL(browser_context, url);
// Now that we have a site, register it with the BrowsingInstance. This
@@ -214,18 +218,18 @@
process_, browsing_instance_->browser_context(), site_url);
}
-content::BrowserContext* SiteInstanceImpl::GetBrowserContext() const {
+BrowserContext* SiteInstanceImpl::GetBrowserContext() const {
return browsing_instance_->browser_context();
}
/*static*/
-SiteInstance* SiteInstance::Create(content::BrowserContext* browser_context) {
+SiteInstance* SiteInstance::Create(BrowserContext* browser_context) {
return new SiteInstanceImpl(new BrowsingInstance(browser_context));
}
/*static*/
-SiteInstance* SiteInstance::CreateForURL(
- content::BrowserContext* browser_context, const GURL& url) {
+SiteInstance* SiteInstance::CreateForURL(BrowserContext* browser_context,
+ const GURL& url) {
// This BrowsingInstance may be deleted if it returns an existing
// SiteInstance.
scoped_refptr<BrowsingInstance> instance(
@@ -234,7 +238,7 @@
}
/*static*/
-GURL SiteInstanceImpl::GetSiteForURL(content::BrowserContext* browser_context,
+GURL SiteInstanceImpl::GetSiteForURL(BrowserContext* browser_context,
const GURL& real_url) {
// TODO(fsamuel, creis): For some reason appID is not recognized as a host.
if (real_url.SchemeIs(chrome::kGuestScheme))
@@ -274,7 +278,7 @@
}
/*static*/
-bool SiteInstance::IsSameWebSite(content::BrowserContext* browser_context,
+bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
const GURL& real_url1,
const GURL& real_url2) {
GURL url1 = SiteInstanceImpl::GetEffectiveURL(browser_context, real_url1);
@@ -303,9 +307,8 @@
}
/*static*/
-GURL SiteInstanceImpl::GetEffectiveURL(
- content::BrowserContext* browser_context,
- const GURL& url) {
+GURL SiteInstanceImpl::GetEffectiveURL(BrowserContext* browser_context,
+ const GURL& url) {
return content::GetContentClient()->browser()->
GetEffectiveURL(browser_context, url);
}
@@ -327,4 +330,3 @@
policy->LockToOrigin(process_->GetID(), site_);
}
}
-