2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc
|
2017-04-20 21:28:17 +02:00
|
|
|
index e9ad038..2a10c80 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/appcache/appcache_internals_ui.cc
|
|
|
|
+++ content/browser/appcache/appcache_internals_ui.cc
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -369,8 +369,8 @@ void AppCacheInternalsUI::CreateProxyForPartition(
|
2016-08-24 11:28:52 +02:00
|
|
|
StoragePartition* storage_partition) {
|
|
|
|
scoped_refptr<Proxy> proxy =
|
|
|
|
new Proxy(weak_ptr_factory_.GetWeakPtr(), storage_partition->GetPath());
|
|
|
|
- proxy->Initialize(static_cast<StoragePartitionImpl*>(storage_partition)
|
|
|
|
- ->GetAppCacheService());
|
|
|
|
+ proxy->Initialize(static_cast<ChromeAppCacheService*>(
|
|
|
|
+ storage_partition->GetAppCacheService()));
|
|
|
|
appcache_proxies_.push_back(proxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
index 92a2e89..e4cacfe 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/blob_storage/chrome_blob_storage_context.cc
|
|
|
|
+++ content/browser/blob_storage/chrome_blob_storage_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -76,6 +76,11 @@ class BlobHandleImpl : public BlobHandle {
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
ChromeBlobStorageContext::ChromeBlobStorageContext() {}
|
|
|
|
|
|
|
|
+// static
|
|
|
|
+const void* ChromeBlobStorageContext::GetUserDataKey() {
|
|
|
|
+ return kBlobStorageContextKeyName;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
|
|
|
|
BrowserContext* context) {
|
|
|
|
if (!context->GetUserData(kBlobStorageContextKeyName)) {
|
|
|
|
diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h
|
2017-05-31 17:33:30 +02:00
|
|
|
index ad4a2a2..7c4212c 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/blob_storage/chrome_blob_storage_context.h
|
|
|
|
+++ content/browser/blob_storage/chrome_blob_storage_context.h
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -45,6 +45,7 @@ class CONTENT_EXPORT ChromeBlobStorageContext
|
2016-08-24 11:28:52 +02:00
|
|
|
public:
|
|
|
|
ChromeBlobStorageContext();
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
+ static const void* GetUserDataKey();
|
2016-08-24 11:28:52 +02:00
|
|
|
static ChromeBlobStorageContext* GetFor(
|
|
|
|
BrowserContext* browser_context);
|
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
diff --git content/browser/bluetooth/web_bluetooth_service_impl.cc content/browser/bluetooth/web_bluetooth_service_impl.cc
|
|
|
|
index 36d4ea7..f696c5b 100644
|
|
|
|
--- content/browser/bluetooth/web_bluetooth_service_impl.cc
|
|
|
|
+++ content/browser/bluetooth/web_bluetooth_service_impl.cc
|
|
|
|
@@ -1194,9 +1194,9 @@ url::Origin WebBluetoothServiceImpl::GetOrigin() {
|
|
|
|
}
|
|
|
|
|
|
|
|
BluetoothAllowedDevices& WebBluetoothServiceImpl::allowed_devices() {
|
|
|
|
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
|
|
|
+ StoragePartition* partition =
|
|
|
|
BrowserContext::GetDefaultStoragePartition(
|
|
|
|
- web_contents()->GetBrowserContext()));
|
|
|
|
+ web_contents()->GetBrowserContext());
|
|
|
|
scoped_refptr<BluetoothAllowedDevicesMap> allowed_devices_map =
|
|
|
|
partition->GetBluetoothAllowedDevicesMap();
|
|
|
|
return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin());
|
2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/browser/browser_context.cc content/browser/browser_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
index 0f23bbe..b21982f 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/browser_context.cc
|
|
|
|
+++ content/browser/browser_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -125,7 +125,14 @@ StoragePartition* GetStoragePartitionFromConfig(
|
2016-08-24 11:28:52 +02:00
|
|
|
if (browser_context->IsOffTheRecord())
|
|
|
|
in_memory = true;
|
|
|
|
|
|
|
|
- return partition_map->Get(partition_domain, partition_name, in_memory);
|
|
|
|
+ StoragePartitionImpl* partition_impl =
|
|
|
|
+ partition_map->Get(partition_domain, partition_name, in_memory);
|
|
|
|
+ if (partition_impl->browser_context() == browser_context)
|
|
|
|
+ return partition_impl;
|
|
|
|
+
|
|
|
|
+ // |browser_context| is a CefBrowserContextProxy object.
|
|
|
|
+ return partition_impl->browser_context()->
|
|
|
|
+ GetStoragePartitionProxy(browser_context, partition_impl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SaveSessionStateOnIOThread(
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -543,6 +550,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
|
|
|
|
BrowserContext::BrowserContext()
|
|
|
|
: media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {}
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
+// static
|
|
|
|
+const void* BrowserContext::GetStoragePartitionMapUserDataKey() {
|
|
|
|
+ return kStoragePartitionMapKeyName;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
BrowserContext::~BrowserContext() {
|
|
|
|
CHECK(GetUserData(kMojoWasInitialized))
|
|
|
|
<< "Attempting to destroy a BrowserContext that never called "
|
|
|
|
diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc
|
2017-01-23 18:36:54 +01:00
|
|
|
index 242d33e..4dfb463 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/devtools/protocol/service_worker_handler.cc
|
|
|
|
+++ content/browser/devtools/protocol/service_worker_handler.cc
|
2017-01-23 18:36:54 +01:00
|
|
|
@@ -321,10 +321,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent(
|
2016-08-24 11:28:52 +02:00
|
|
|
if (!base::StringToInt64(registration_id, &id))
|
|
|
|
return CreateInvalidVersionIdErrorResponse();
|
|
|
|
|
|
|
|
- StoragePartitionImpl* partition =
|
|
|
|
- static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
|
|
|
|
+ StoragePartition* partition = BrowserContext::GetStoragePartition(
|
|
|
|
render_frame_host_->GetProcess()->GetBrowserContext(),
|
|
|
|
- render_frame_host_->GetSiteInstance()));
|
|
|
|
+ render_frame_host_->GetSiteInstance());
|
|
|
|
BackgroundSyncContext* sync_context = partition->GetBackgroundSyncContext();
|
|
|
|
|
|
|
|
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
2017-05-31 17:33:30 +02:00
|
|
|
diff --git content/browser/loader/navigation_url_loader_network_service.cc content/browser/loader/navigation_url_loader_network_service.cc
|
|
|
|
index f32156a..c2373f8 100644
|
|
|
|
--- content/browser/loader/navigation_url_loader_network_service.cc
|
|
|
|
+++ content/browser/loader/navigation_url_loader_network_service.cc
|
|
|
|
@@ -196,8 +196,8 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
|
|
|
|
: nullptr,
|
|
|
|
appcache_handle ? appcache_handle->core() : nullptr,
|
|
|
|
request_info_.get(), base::Passed(std::move(factory_ptr_info)),
|
|
|
|
- static_cast<StoragePartitionImpl*>(storage_partition)
|
|
|
|
- ->url_loader_factory_getter(),
|
|
|
|
+ scoped_refptr<URLLoaderFactoryGetter>(
|
|
|
|
+ storage_partition->url_loader_factory_getter()),
|
|
|
|
base::Bind(&GetWebContentsFromFrameTreeNodeID,
|
|
|
|
request_info_->frame_tree_node_id),
|
|
|
|
base::Passed(std::move(loader_associated_request)),
|
|
|
|
diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc
|
|
|
|
index 73f3cba..55d488b 100644
|
|
|
|
--- content/browser/payments/payment_app_provider_impl.cc
|
|
|
|
+++ content/browser/payments/payment_app_provider_impl.cc
|
|
|
|
@@ -153,8 +153,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps(
|
|
|
|
GetAllPaymentAppsCallback callback) {
|
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
|
|
|
|
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
|
|
|
- BrowserContext::GetDefaultStoragePartition(browser_context));
|
|
|
|
+ StoragePartition* partition =
|
|
|
|
+ BrowserContext::GetDefaultStoragePartition(browser_context);
|
|
|
|
scoped_refptr<PaymentAppContextImpl> payment_app_context =
|
|
|
|
partition->GetPaymentAppContext();
|
|
|
|
|
|
|
|
@@ -171,10 +171,11 @@ void PaymentAppProviderImpl::InvokePaymentApp(
|
|
|
|
const InvokePaymentAppCallback& callback) {
|
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
|
|
|
|
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
|
|
|
- BrowserContext::GetDefaultStoragePartition(browser_context));
|
|
|
|
+ StoragePartition* partition =
|
|
|
|
+ BrowserContext::GetDefaultStoragePartition(browser_context);
|
|
|
|
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context =
|
|
|
|
- partition->GetServiceWorkerContext();
|
|
|
|
+ static_cast<ServiceWorkerContextWrapper*>(
|
|
|
|
+ partition->GetServiceWorkerContext());
|
|
|
|
|
|
|
|
BrowserThread::PostTask(
|
|
|
|
BrowserThread::IO, FROM_HERE,
|
2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
|
2017-06-02 22:26:54 +02:00
|
|
|
index cbd667c..c0158c9 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/renderer_host/render_process_host_impl.cc
|
|
|
|
+++ content/browser/renderer_host/render_process_host_impl.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -482,7 +482,7 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data,
|
|
|
|
// own non-shared process.
|
|
|
|
if (partition != default_partition || is_for_guests_only) {
|
|
|
|
RenderProcessHostImpl* host = new RenderProcessHostImpl(
|
|
|
|
- browser_context_, static_cast<StoragePartitionImpl*>(partition),
|
|
|
|
+ browser_context_, partition,
|
|
|
|
is_for_guests_only);
|
|
|
|
host->SetIsNeverSuitableForReuse();
|
|
|
|
return host;
|
|
|
|
@@ -494,7 +494,7 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data,
|
|
|
|
return host_;
|
|
|
|
|
|
|
|
host_ = new RenderProcessHostImpl(
|
|
|
|
- browser_context_, static_cast<StoragePartitionImpl*>(partition),
|
|
|
|
+ browser_context_, partition,
|
|
|
|
false /* for guests only */);
|
|
|
|
host_->SetIsNeverSuitableForReuse();
|
|
|
|
host_->AddObserver(this);
|
|
|
|
@@ -907,7 +907,7 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) {
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
RenderProcessHostImpl::RenderProcessHostImpl(
|
|
|
|
BrowserContext* browser_context,
|
|
|
|
- StoragePartitionImpl* storage_partition_impl,
|
|
|
|
+ StoragePartition* storage_partition_impl,
|
|
|
|
bool is_for_guests_only)
|
|
|
|
: fast_shutdown_started_(false),
|
|
|
|
deleting_soon_(false),
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -939,7 +939,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
|
2017-01-23 18:36:54 +01:00
|
|
|
indexed_db_factory_(new IndexedDBDispatcherHost(
|
|
|
|
id_,
|
|
|
|
storage_partition_impl_->GetURLRequestContext(),
|
|
|
|
- storage_partition_impl_->GetIndexedDBContext(),
|
|
|
|
+ static_cast<IndexedDBContextImpl*>(
|
|
|
|
+ storage_partition_impl_->GetIndexedDBContext()),
|
|
|
|
ChromeBlobStorageContext::GetFor(browser_context_))),
|
|
|
|
channel_connected_(false),
|
|
|
|
sent_render_process_ready_(false),
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -970,7 +971,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
|
2017-03-03 23:37:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
push_messaging_manager_.reset(new PushMessagingManager(
|
|
|
|
- GetID(), storage_partition_impl_->GetServiceWorkerContext()));
|
|
|
|
+ GetID(), static_cast<ServiceWorkerContextWrapper*>(
|
|
|
|
+ storage_partition_impl_->GetServiceWorkerContext())));
|
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
AddObserver(indexed_db_factory_.get());
|
2017-03-03 23:37:23 +01:00
|
|
|
#if defined(OS_MACOSX)
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1176,7 +1178,7 @@ bool RenderProcessHostImpl::Init() {
|
2017-02-14 19:09:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void RenderProcessHostImpl::EnableSendQueue() {
|
|
|
|
- if (!channel_)
|
|
|
|
+ if (!channel_ && browser_context_)
|
|
|
|
InitializeChannelProxy();
|
|
|
|
}
|
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1273,6 +1275,22 @@ void RenderProcessHostImpl::ResetChannelProxy() {
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
void RenderProcessHostImpl::CreateMessageFilters() {
|
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
+
|
|
|
|
+ // Cast to the derived type from StoragePartitionImpl.
|
|
|
|
+ auto app_cache_service = static_cast<ChromeAppCacheService*>(
|
|
|
|
+ storage_partition_impl_->GetAppCacheService());
|
|
|
|
+ auto dom_storage_context = static_cast<DOMStorageContextWrapper*>(
|
|
|
|
+ storage_partition_impl_->GetDOMStorageContext());
|
|
|
|
+ auto indexed_db_context = static_cast<IndexedDBContextImpl*>(
|
|
|
|
+ storage_partition_impl_->GetIndexedDBContext());
|
|
|
|
+ auto cache_storage_context = static_cast<CacheStorageContextImpl*>(
|
|
|
|
+ storage_partition_impl_->GetCacheStorageContext());
|
|
|
|
+ auto service_worker_context = static_cast<ServiceWorkerContextWrapper*>(
|
|
|
|
+ storage_partition_impl_->GetServiceWorkerContext());
|
|
|
|
+ auto platform_notification_context =
|
|
|
|
+ static_cast<PlatformNotificationContextImpl*>(
|
|
|
|
+ storage_partition_impl_->GetPlatformNotificationContext());
|
|
|
|
+
|
|
|
|
AddFilter(new ResourceSchedulerFilter(GetID()));
|
|
|
|
MediaInternals* media_internals = MediaInternals::GetInstance();
|
2016-08-31 13:25:56 +02:00
|
|
|
// Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1287,8 +1305,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2016-08-24 11:28:52 +02:00
|
|
|
new RenderMessageFilter(
|
|
|
|
GetID(), GetBrowserContext(), request_context.get(),
|
2016-08-31 13:25:56 +02:00
|
|
|
widget_helper_.get(), media_internals,
|
2016-08-24 11:28:52 +02:00
|
|
|
- storage_partition_impl_->GetDOMStorageContext(),
|
|
|
|
- storage_partition_impl_->GetCacheStorageContext()));
|
|
|
|
+ dom_storage_context,
|
|
|
|
+ cache_storage_context));
|
|
|
|
AddFilter(render_message_filter.get());
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
render_frame_message_filter_ = new RenderFrameMessageFilter(
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1317,10 +1335,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2017-01-23 18:36:54 +01:00
|
|
|
ChromeBlobStorageContext::GetFor(browser_context);
|
2016-08-31 13:25:56 +02:00
|
|
|
|
|
|
|
resource_message_filter_ = new ResourceMessageFilter(
|
2017-01-23 18:36:54 +01:00
|
|
|
- GetID(), storage_partition_impl_->GetAppCacheService(),
|
|
|
|
+ GetID(), app_cache_service,
|
|
|
|
blob_storage_context.get(),
|
2016-08-24 11:28:52 +02:00
|
|
|
storage_partition_impl_->GetFileSystemContext(),
|
2017-04-20 21:28:17 +02:00
|
|
|
- storage_partition_impl_->GetServiceWorkerContext(), get_contexts_callback,
|
|
|
|
+ service_worker_context, get_contexts_callback,
|
|
|
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2016-11-23 21:54:29 +01:00
|
|
|
AddFilter(resource_message_filter_.get());
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1344,10 +1362,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2016-08-24 11:28:52 +02:00
|
|
|
AddFilter(
|
2017-01-23 18:36:54 +01:00
|
|
|
new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service()));
|
|
|
|
AddFilter(new AppCacheDispatcherHost(
|
2016-08-24 11:28:52 +02:00
|
|
|
- storage_partition_impl_->GetAppCacheService(), GetID()));
|
2017-01-23 18:36:54 +01:00
|
|
|
+ app_cache_service, GetID()));
|
2016-08-24 11:28:52 +02:00
|
|
|
AddFilter(new ClipboardMessageFilter(blob_storage_context));
|
2017-01-23 18:36:54 +01:00
|
|
|
AddFilter(new DOMStorageMessageFilter(
|
2016-08-24 11:28:52 +02:00
|
|
|
- storage_partition_impl_->GetDOMStorageContext()));
|
2017-01-23 18:36:54 +01:00
|
|
|
+ dom_storage_context));
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2017-01-23 18:36:54 +01:00
|
|
|
#if BUILDFLAG(ENABLE_WEBRTC)
|
|
|
|
peer_connection_tracker_host_ = new PeerConnectionTrackerHost(
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1386,13 +1404,12 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
scoped_refptr<CacheStorageDispatcherHost> cache_storage_filter =
|
|
|
|
new CacheStorageDispatcherHost();
|
|
|
|
- cache_storage_filter->Init(storage_partition_impl_->GetCacheStorageContext());
|
|
|
|
+ cache_storage_filter->Init(cache_storage_context);
|
|
|
|
AddFilter(cache_storage_filter.get());
|
|
|
|
|
|
|
|
scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter =
|
2017-03-03 23:37:23 +01:00
|
|
|
new ServiceWorkerDispatcherHost(GetID(), resource_context);
|
2016-08-24 11:28:52 +02:00
|
|
|
- service_worker_filter->Init(
|
|
|
|
- storage_partition_impl_->GetServiceWorkerContext());
|
|
|
|
+ service_worker_filter->Init(service_worker_context);
|
|
|
|
AddFilter(service_worker_filter.get());
|
|
|
|
|
|
|
|
AddFilter(new SharedWorkerMessageFilter(
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1400,12 +1417,12 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2016-08-24 11:28:52 +02:00
|
|
|
WorkerStoragePartition(
|
|
|
|
storage_partition_impl_->GetURLRequestContext(),
|
|
|
|
storage_partition_impl_->GetMediaURLRequestContext(),
|
|
|
|
- storage_partition_impl_->GetAppCacheService(),
|
|
|
|
+ app_cache_service,
|
|
|
|
storage_partition_impl_->GetQuotaManager(),
|
|
|
|
storage_partition_impl_->GetFileSystemContext(),
|
|
|
|
storage_partition_impl_->GetDatabaseTracker(),
|
|
|
|
- storage_partition_impl_->GetIndexedDBContext(),
|
|
|
|
- storage_partition_impl_->GetServiceWorkerContext()),
|
|
|
|
+ indexed_db_context,
|
|
|
|
+ service_worker_context),
|
2017-03-03 23:37:23 +01:00
|
|
|
base::Bind(&RenderWidgetHelper::GetNextRoutingID,
|
|
|
|
base::Unretained(widget_helper_.get()))));
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1421,11 +1438,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2016-08-31 13:25:56 +02:00
|
|
|
GetID(), storage_partition_impl_->GetQuotaManager(),
|
2016-08-24 11:28:52 +02:00
|
|
|
GetContentClient()->browser()->CreateQuotaPermissionContext()));
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context(
|
|
|
|
- static_cast<ServiceWorkerContextWrapper*>(
|
|
|
|
- storage_partition_impl_->GetServiceWorkerContext()));
|
2016-08-24 11:28:52 +02:00
|
|
|
notification_message_filter_ = new NotificationMessageFilter(
|
|
|
|
- GetID(), storage_partition_impl_->GetPlatformNotificationContext(),
|
|
|
|
+ GetID(), platform_notification_context,
|
2016-08-31 13:25:56 +02:00
|
|
|
resource_context, service_worker_context, browser_context);
|
2016-08-24 11:28:52 +02:00
|
|
|
AddFilter(notification_message_filter_.get());
|
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1441,6 +1455,11 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
2017-04-20 21:28:17 +02:00
|
|
|
void RenderProcessHostImpl::RegisterMojoInterfaces() {
|
|
|
|
auto registry = base::MakeUnique<service_manager::BinderRegistry>();
|
2016-10-21 21:52:29 +02:00
|
|
|
|
2017-03-03 23:37:23 +01:00
|
|
|
+ // Cast to the derived type from StoragePartitionImpl.
|
2016-08-24 11:28:52 +02:00
|
|
|
+ auto platform_notification_context =
|
|
|
|
+ static_cast<PlatformNotificationContextImpl*>(
|
|
|
|
+ storage_partition_impl_->GetPlatformNotificationContext());
|
|
|
|
+
|
2017-03-03 23:37:23 +01:00
|
|
|
channel_->AddAssociatedInterfaceForIOThread(
|
2017-04-20 21:28:17 +02:00
|
|
|
base::Bind(&IndexedDBDispatcherHost::AddBinding,
|
|
|
|
base::Unretained(indexed_db_factory_.get())));
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1488,8 +1507,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
|
2016-08-31 13:25:56 +02:00
|
|
|
AddUIThreadInterface(
|
|
|
|
registry.get(),
|
|
|
|
base::Bind(&PlatformNotificationContextImpl::CreateService,
|
|
|
|
- base::Unretained(
|
|
|
|
- storage_partition_impl_->GetPlatformNotificationContext()),
|
|
|
|
+ base::Unretained(platform_notification_context),
|
|
|
|
GetID()));
|
|
|
|
AddUIThreadInterface(
|
|
|
|
registry.get(),
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -1725,6 +1743,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() {
|
2016-11-03 18:11:09 +01:00
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
DCHECK(!is_worker_ref_count_disabled_);
|
|
|
|
is_worker_ref_count_disabled_ = true;
|
|
|
|
+ browser_context_ = nullptr;
|
2017-01-23 18:36:54 +01:00
|
|
|
if (!GetWorkerRefCount())
|
2016-11-03 18:11:09 +01:00
|
|
|
return;
|
|
|
|
service_worker_ref_count_ = 0;
|
2017-06-02 22:26:54 +02:00
|
|
|
@@ -3065,8 +3084,8 @@ RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSiteInstance(
|
2017-05-31 17:33:30 +02:00
|
|
|
g_render_process_host_factory_->CreateRenderProcessHost(
|
|
|
|
browser_context, site_instance);
|
|
|
|
} else {
|
|
|
|
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
|
|
|
|
- BrowserContext::GetStoragePartition(browser_context, site_instance));
|
|
|
|
+ StoragePartition* partition =
|
|
|
|
+ BrowserContext::GetStoragePartition(browser_context, site_instance);
|
|
|
|
render_process_host = new RenderProcessHostImpl(
|
|
|
|
browser_context, partition, is_for_guests_only);
|
|
|
|
}
|
2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h
|
2017-05-31 17:33:30 +02:00
|
|
|
index 8d5033e..45b8a7c 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/renderer_host/render_process_host_impl.h
|
|
|
|
+++ content/browser/renderer_host/render_process_host_impl.h
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -80,7 +80,6 @@ class RenderWidgetHostImpl;
|
2016-08-31 13:25:56 +02:00
|
|
|
class ResourceMessageFilter;
|
2017-05-31 17:33:30 +02:00
|
|
|
class SiteInstanceImpl;
|
2016-08-24 11:28:52 +02:00
|
|
|
class StoragePartition;
|
|
|
|
-class StoragePartitionImpl;
|
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
typedef base::Thread* (*RendererMainThreadFactoryFunction)(
|
|
|
|
const InProcessChildThreadParams& params);
|
|
|
|
@@ -112,7 +111,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
|
2016-10-17 20:14:44 +02:00
|
|
|
public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) {
|
2016-08-24 11:28:52 +02:00
|
|
|
public:
|
|
|
|
RenderProcessHostImpl(BrowserContext* browser_context,
|
|
|
|
- StoragePartitionImpl* storage_partition_impl,
|
|
|
|
+ StoragePartition* storage_partition_impl,
|
|
|
|
bool is_for_guests_only);
|
|
|
|
~RenderProcessHostImpl() override;
|
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -581,10 +580,10 @@ class CONTENT_EXPORT RenderProcessHostImpl
|
2017-04-20 21:28:17 +02:00
|
|
|
// called.
|
|
|
|
int instance_id_ = 1;
|
|
|
|
|
|
|
|
- BrowserContext* const browser_context_;
|
|
|
|
+ BrowserContext* browser_context_;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
// Owned by |browser_context_|.
|
|
|
|
- StoragePartitionImpl* storage_partition_impl_;
|
|
|
|
+ StoragePartition* storage_partition_impl_;
|
|
|
|
|
|
|
|
// The observers watching our lifetime.
|
|
|
|
base::ObserverList<RenderProcessHostObserver> observers_;
|
|
|
|
diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h
|
2017-05-31 17:33:30 +02:00
|
|
|
index 58a6de1..4835648 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/storage_partition_impl.h
|
|
|
|
+++ content/browser/storage_partition_impl.h
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -110,12 +110,11 @@ class CONTENT_EXPORT StoragePartitionImpl
|
|
|
|
const base::Closure& callback) override;
|
|
|
|
void Flush() override;
|
2017-03-03 23:37:23 +01:00
|
|
|
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
2016-08-24 11:28:52 +02:00
|
|
|
-
|
2017-04-20 21:28:17 +02:00
|
|
|
- BackgroundFetchContext* GetBackgroundFetchContext();
|
2016-08-24 11:28:52 +02:00
|
|
|
- BackgroundSyncContext* GetBackgroundSyncContext();
|
2017-01-23 18:36:54 +01:00
|
|
|
- PaymentAppContextImpl* GetPaymentAppContext();
|
2016-08-31 13:25:56 +02:00
|
|
|
- BroadcastChannelProvider* GetBroadcastChannelProvider();
|
2017-03-03 23:37:23 +01:00
|
|
|
- BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap();
|
2017-04-20 21:28:17 +02:00
|
|
|
+ BackgroundFetchContext* GetBackgroundFetchContext() override;
|
2016-08-24 11:28:52 +02:00
|
|
|
+ BackgroundSyncContext* GetBackgroundSyncContext() override;
|
2017-01-23 18:36:54 +01:00
|
|
|
+ PaymentAppContextImpl* GetPaymentAppContext() override;
|
2016-08-31 13:25:56 +02:00
|
|
|
+ BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
2017-03-03 23:37:23 +01:00
|
|
|
+ BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
// mojom::StoragePartitionService interface.
|
|
|
|
void OpenLocalStorage(
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -124,17 +123,20 @@ class CONTENT_EXPORT StoragePartitionImpl
|
|
|
|
|
|
|
|
// Returns the NetworkContext associated with this storage partition. Only
|
|
|
|
// used when the network service is enabled.
|
|
|
|
- mojom::NetworkContext* network_context() { return network_context_.get(); }
|
|
|
|
+ mojom::NetworkContext* network_context() override {
|
|
|
|
+ return network_context_.get();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter() {
|
|
|
|
- return url_loader_factory_getter_;
|
|
|
|
+ URLLoaderFactoryGetter* url_loader_factory_getter() override {
|
|
|
|
+ return url_loader_factory_getter_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can return nullptr while |this| is being destroyed.
|
|
|
|
- BrowserContext* browser_context() const;
|
|
|
|
+ BrowserContext* browser_context() const override;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
// Called by each renderer process once.
|
|
|
|
- void Bind(mojo::InterfaceRequest<mojom::StoragePartitionService> request);
|
|
|
|
+ void Bind(mojo::InterfaceRequest<mojom::StoragePartitionService> request)
|
|
|
|
+ override;
|
|
|
|
|
|
|
|
struct DataDeletionHelper;
|
|
|
|
struct QuotaManagedDataDeletionHelper;
|
|
|
|
diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
index 22e3c06..883114d 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/browser/streams/stream_context.cc
|
|
|
|
+++ content/browser/streams/stream_context.cc
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -22,6 +22,11 @@ namespace content {
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
StreamContext::StreamContext() {}
|
|
|
|
|
|
|
|
+// static
|
|
|
|
+const void* StreamContext::GetUserDataKey() {
|
|
|
|
+ return kStreamContextKeyName;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
StreamContext* StreamContext::GetFor(BrowserContext* context) {
|
|
|
|
if (!context->GetUserData(kStreamContextKeyName)) {
|
|
|
|
scoped_refptr<StreamContext> stream = new StreamContext();
|
|
|
|
diff --git content/browser/streams/stream_context.h content/browser/streams/stream_context.h
|
|
|
|
index 075ae3e..57fb5fd 100644
|
|
|
|
--- content/browser/streams/stream_context.h
|
|
|
|
+++ content/browser/streams/stream_context.h
|
|
|
|
@@ -29,6 +29,7 @@ class StreamContext
|
|
|
|
public:
|
|
|
|
StreamContext();
|
|
|
|
|
|
|
|
+ CONTENT_EXPORT static const void* GetUserDataKey();
|
|
|
|
CONTENT_EXPORT static StreamContext* GetFor(BrowserContext* browser_context);
|
|
|
|
|
|
|
|
void InitializeOnIOThread();
|
2017-05-31 17:33:30 +02:00
|
|
|
diff --git content/browser/webui/web_ui_url_loader_factory.cc content/browser/webui/web_ui_url_loader_factory.cc
|
|
|
|
index e85627c..3f55353 100644
|
|
|
|
--- content/browser/webui/web_ui_url_loader_factory.cc
|
|
|
|
+++ content/browser/webui/web_ui_url_loader_factory.cc
|
|
|
|
@@ -18,7 +18,6 @@
|
|
|
|
#include "content/browser/frame_host/render_frame_host_impl.h"
|
|
|
|
#include "content/browser/histogram_internals_url_loader.h"
|
|
|
|
#include "content/browser/resource_context_impl.h"
|
|
|
|
-#include "content/browser/storage_partition_impl.h"
|
|
|
|
#include "content/browser/webui/network_error_url_loader.h"
|
|
|
|
#include "content/browser/webui/url_data_manager_backend.h"
|
|
|
|
#include "content/browser/webui/url_data_source_impl.h"
|
|
|
|
@@ -26,6 +25,7 @@
|
|
|
|
#include "content/public/browser/browser_context.h"
|
|
|
|
#include "content/public/browser/browser_thread.h"
|
|
|
|
#include "content/public/browser/render_process_host.h"
|
|
|
|
+#include "content/public/browser/storage_partition.h"
|
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
|
#include "content/public/common/url_constants.h"
|
|
|
|
#include "mojo/public/cpp/bindings/binding_set.h"
|
|
|
|
@@ -210,8 +210,8 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory,
|
|
|
|
public:
|
|
|
|
WebUIURLLoaderFactory(FrameTreeNode* ftn)
|
|
|
|
: frame_tree_node_id_(ftn->frame_tree_node_id()),
|
|
|
|
- storage_partition_(static_cast<StoragePartitionImpl*>(
|
|
|
|
- ftn->current_frame_host()->GetProcess()->GetStoragePartition())) {
|
|
|
|
+ storage_partition_(
|
|
|
|
+ ftn->current_frame_host()->GetProcess()->GetStoragePartition()) {
|
|
|
|
ftn->AddObserver(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -278,7 +278,7 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory,
|
|
|
|
|
|
|
|
private:
|
|
|
|
int frame_tree_node_id_;
|
|
|
|
- StoragePartitionImpl* storage_partition_;
|
|
|
|
+ StoragePartition* storage_partition_;
|
|
|
|
mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WebUIURLLoaderFactory);
|
2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h
|
2017-05-31 17:33:30 +02:00
|
|
|
index 7a895f2..687da7c 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/public/browser/browser_context.h
|
|
|
|
+++ content/public/browser/browser_context.h
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -185,6 +185,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
|
|
|
|
|
|
|
|
BrowserContext();
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
+ static const void* GetStoragePartitionMapUserDataKey();
|
|
|
|
+
|
|
|
|
~BrowserContext() override;
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
// Shuts down the storage partitions associated to this browser context.
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -266,6 +268,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
|
2016-08-24 11:28:52 +02:00
|
|
|
const base::FilePath& partition_path,
|
|
|
|
bool in_memory) = 0;
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2016-08-24 11:28:52 +02:00
|
|
|
+ // CEF returns a proxy object that forwards method calls to |partition_impl|.
|
|
|
|
+ virtual content::StoragePartition* GetStoragePartitionProxy(
|
|
|
|
+ BrowserContext* browser_context,
|
|
|
|
+ content::StoragePartition* partition_impl) {
|
|
|
|
+ NOTREACHED();
|
|
|
|
+ return nullptr;
|
|
|
|
+ }
|
2017-04-20 21:28:17 +02:00
|
|
|
+
|
|
|
|
using StaticServiceMap = std::map<std::string, ServiceInfo>;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
// Registers per-browser-context services to be loaded in the browser process
|
2016-08-24 11:28:52 +02:00
|
|
|
diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h
|
2017-05-31 17:33:30 +02:00
|
|
|
index 60e5c7d..14f50b3 100644
|
2016-08-24 11:28:52 +02:00
|
|
|
--- content/public/browser/storage_partition.h
|
|
|
|
+++ content/public/browser/storage_partition.h
|
2017-02-14 17:47:27 +01:00
|
|
|
@@ -13,6 +13,7 @@
|
2016-08-24 11:28:52 +02:00
|
|
|
#include "base/files/file_path.h"
|
|
|
|
#include "base/time/time.h"
|
|
|
|
#include "content/common/content_export.h"
|
|
|
|
+#include "mojo/public/cpp/bindings/binding_set.h"
|
|
|
|
#include "net/cookies/cookie_store.h"
|
|
|
|
|
|
|
|
class GURL;
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -41,12 +42,18 @@ class DatabaseTracker;
|
2016-08-24 11:28:52 +02:00
|
|
|
namespace content {
|
|
|
|
|
|
|
|
class AppCacheService;
|
2017-04-20 21:28:17 +02:00
|
|
|
+class BackgroundFetchContext;
|
2016-08-24 11:28:52 +02:00
|
|
|
+class BackgroundSyncContext;
|
2017-03-03 23:37:23 +01:00
|
|
|
+class BluetoothAllowedDevicesMap;
|
2016-08-31 13:25:56 +02:00
|
|
|
+class BroadcastChannelProvider;
|
2016-08-24 11:28:52 +02:00
|
|
|
class BrowserContext;
|
|
|
|
class CacheStorageContext;
|
|
|
|
class DOMStorageContext;
|
2016-11-23 21:54:29 +01:00
|
|
|
class IndexedDBContext;
|
2017-01-23 18:36:54 +01:00
|
|
|
+class PaymentAppContextImpl;
|
2016-11-23 21:54:29 +01:00
|
|
|
class PlatformNotificationContext;
|
|
|
|
class ServiceWorkerContext;
|
2017-05-31 17:33:30 +02:00
|
|
|
+class URLLoaderFactoryGetter;
|
|
|
|
|
|
|
|
#if !defined(OS_ANDROID)
|
|
|
|
class HostZoomLevelContext;
|
|
|
|
@@ -54,6 +61,11 @@ class HostZoomMap;
|
2016-11-23 21:54:29 +01:00
|
|
|
class ZoomLevelDelegate;
|
2017-05-31 17:33:30 +02:00
|
|
|
#endif // !defined(OS_ANDROID)
|
2017-02-14 17:47:27 +01:00
|
|
|
|
|
|
|
+namespace mojom {
|
2017-05-31 17:33:30 +02:00
|
|
|
+class NetworkContext;
|
2017-02-14 17:47:27 +01:00
|
|
|
+class StoragePartitionService;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
// Defines what persistent state a child process can access.
|
|
|
|
//
|
|
|
|
// The StoragePartition defines the view each child process has of the
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -79,6 +91,11 @@ class CONTENT_EXPORT StoragePartition {
|
2016-08-24 11:28:52 +02:00
|
|
|
virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0;
|
2017-05-31 17:33:30 +02:00
|
|
|
#endif // !defined(OS_ANDROID)
|
2016-08-24 11:28:52 +02:00
|
|
|
virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0;
|
2017-04-20 21:28:17 +02:00
|
|
|
+ virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0;
|
2016-08-24 11:28:52 +02:00
|
|
|
+ virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0;
|
2017-01-23 18:36:54 +01:00
|
|
|
+ virtual PaymentAppContextImpl* GetPaymentAppContext() = 0;
|
2016-08-31 13:25:56 +02:00
|
|
|
+ virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0;
|
2017-03-03 23:37:23 +01:00
|
|
|
+ virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
|
|
|
enum : uint32_t {
|
|
|
|
REMOVE_DATA_MASK_APPCACHE = 1 << 0,
|
2017-05-31 17:33:30 +02:00
|
|
|
@@ -184,6 +201,14 @@ class CONTENT_EXPORT StoragePartition {
|
2017-03-03 23:37:23 +01:00
|
|
|
// Clear the bluetooth allowed devices map. For test use only.
|
|
|
|
virtual void ClearBluetoothAllowedDevicesMapForTesting() = 0;
|
2016-08-24 11:28:52 +02:00
|
|
|
|
2017-05-31 17:33:30 +02:00
|
|
|
+ virtual mojom::NetworkContext* network_context() = 0;
|
|
|
|
+ virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0;
|
|
|
|
+ virtual BrowserContext* browser_context() const = 0;
|
|
|
|
+
|
2016-08-24 11:28:52 +02:00
|
|
|
+ // Called by each renderer process once.
|
|
|
|
+ virtual void Bind(
|
|
|
|
+ mojo::InterfaceRequest<mojom::StoragePartitionService> request) = 0;
|
|
|
|
+
|
|
|
|
protected:
|
|
|
|
virtual ~StoragePartition() {}
|
|
|
|
};
|