cef/patch/patches/storage_partition_1973.patch

1001 lines
47 KiB
Diff
Raw Normal View History

diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc
index d63844fe8e67..57c990dbb994 100644
--- content/browser/appcache/appcache_internals_ui.cc
+++ content/browser/appcache/appcache_internals_ui.cc
@@ -386,8 +386,8 @@ void AppCacheInternalsUI::CreateProxyForPartition(
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/background_fetch/background_fetch_service_impl.cc content/browser/background_fetch/background_fetch_service_impl.cc
index a19d29165970..aaf918cd4b71 100644
--- content/browser/background_fetch/background_fetch_service_impl.cc
+++ content/browser/background_fetch/background_fetch_service_impl.cc
@@ -49,8 +49,7 @@ void BackgroundFetchServiceImpl::CreateForWorker(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
BackgroundFetchServiceImpl::CreateOnIoThread,
- WrapRefCounted(static_cast<StoragePartitionImpl*>(
- render_process_host->GetStoragePartition())
+ WrapRefCounted(render_process_host->GetStoragePartition()
->GetBackgroundFetchContext()),
origin, /* render_frame_tree_node_id= */ 0,
/* wc_getter= */ base::NullCallback(), std::move(request)));
@@ -81,8 +80,7 @@ void BackgroundFetchServiceImpl::CreateForFrame(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
BackgroundFetchServiceImpl::CreateOnIoThread,
- WrapRefCounted(static_cast<StoragePartitionImpl*>(
- render_process_host->GetStoragePartition())
+ WrapRefCounted(render_process_host->GetStoragePartition()
->GetBackgroundFetchContext()),
render_frame_host->GetLastCommittedOrigin(),
render_frame_host->GetFrameTreeNodeId(), std::move(wc_getter),
diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc
index 8c5b2fc028c3..d6848a7e8750 100644
--- content/browser/blob_storage/chrome_blob_storage_context.cc
+++ content/browser/blob_storage/chrome_blob_storage_context.cc
@@ -88,6 +88,11 @@ class BlobHandleImpl : public BlobHandle {
ChromeBlobStorageContext::ChromeBlobStorageContext() {}
+// static
+const void* ChromeBlobStorageContext::GetUserDataKey() {
+ return kBlobStorageContextKeyName;
+}
+
// static
ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
BrowserContext* context) {
diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h
index 26cf1ebfdffc..f6de541d25d1 100644
--- content/browser/blob_storage/chrome_blob_storage_context.h
+++ content/browser/blob_storage/chrome_blob_storage_context.h
@@ -50,6 +50,8 @@ class CONTENT_EXPORT ChromeBlobStorageContext
public:
ChromeBlobStorageContext();
+ static const void* GetUserDataKey();
+
// Must be called on the UI thread.
static ChromeBlobStorageContext* GetFor(
BrowserContext* browser_context);
diff --git content/browser/bluetooth/web_bluetooth_service_impl.cc content/browser/bluetooth/web_bluetooth_service_impl.cc
index 6952610f8c88..fd8babeb99fd 100644
--- content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -1554,9 +1554,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());
diff --git content/browser/browser_context.cc content/browser/browser_context.cc
index 68e34ea69ecc..da82a4d99a91 100644
--- content/browser/browser_context.cc
+++ content/browser/browser_context.cc
@@ -210,11 +210,18 @@ StoragePartition* GetStoragePartitionFromConfig(
StoragePartitionImplMap* partition_map =
GetStoragePartitionMap(browser_context);
- if (browser_context->IsOffTheRecord())
+ if (browser_context->IsOffTheRecord() || browser_context->GetPath().empty())
in_memory = true;
- return partition_map->Get(partition_domain, partition_name, in_memory,
- can_create);
+ StoragePartitionImpl* partition_impl =
+ partition_map->Get(partition_domain, partition_name, in_memory,
+ can_create);
+ 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(
@@ -732,6 +739,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
BrowserContext::BrowserContext()
: unique_id_(base::UnguessableToken::Create().ToString()) {}
+// static
+const void* BrowserContext::GetStoragePartitionMapUserDataKey() {
+ return kStoragePartitionMapKeyName;
+}
+
BrowserContext::~BrowserContext() {
CHECK(GetUserData(kServiceInstanceGroup))
<< "Attempting to destroy a BrowserContext that never called "
diff --git content/browser/devtools/protocol/network_handler.cc content/browser/devtools/protocol/network_handler.cc
index 69d2ffaea87b..5eb30fe7f22f 100644
--- content/browser/devtools/protocol/network_handler.cc
+++ content/browser/devtools/protocol/network_handler.cc
@@ -807,8 +807,7 @@ class BackgroundSyncRestorer {
scoped_refptr<ServiceWorkerDevToolsAgentHost> service_worker_host =
static_cast<ServiceWorkerDevToolsAgentHost*>(host.get());
scoped_refptr<BackgroundSyncContext> sync_context =
- static_cast<StoragePartitionImpl*>(storage_partition_)
- ->GetBackgroundSyncContext();
+ storage_partition_->GetBackgroundSyncContext();
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc
index 3dc663a54995..8ed420d31c0d 100644
--- content/browser/devtools/protocol/service_worker_handler.cc
+++ content/browser/devtools/protocol/service_worker_handler.cc
@@ -173,8 +173,7 @@ void ServiceWorkerHandler::SetRenderer(int process_host_id,
return;
}
- storage_partition_ =
- static_cast<StoragePartitionImpl*>(process_host->GetStoragePartition());
+ storage_partition_ = process_host->GetStoragePartition();
DCHECK(storage_partition_);
browser_context_ = process_host->GetBrowserContext();
context_ = static_cast<ServiceWorkerContextWrapper*>(
diff --git content/browser/devtools/protocol/service_worker_handler.h content/browser/devtools/protocol/service_worker_handler.h
index ec9ab86d0ca6..0fe5219f1e84 100644
--- content/browser/devtools/protocol/service_worker_handler.h
+++ content/browser/devtools/protocol/service_worker_handler.h
@@ -24,7 +24,7 @@ class BrowserContext;
class RenderFrameHostImpl;
class ServiceWorkerContextWatcher;
class ServiceWorkerContextWrapper;
-class StoragePartitionImpl;
+class StoragePartition;
namespace protocol {
@@ -74,7 +74,7 @@ class ServiceWorkerHandler : public DevToolsDomainHandler,
bool enabled_;
scoped_refptr<ServiceWorkerContextWatcher> context_watcher_;
BrowserContext* browser_context_;
- StoragePartitionImpl* storage_partition_;
+ StoragePartition* storage_partition_;
base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_;
diff --git content/browser/download/download_manager_impl.cc content/browser/download/download_manager_impl.cc
index 5da8761a8e1b..f573f9f49434 100644
--- content/browser/download/download_manager_impl.cc
+++ content/browser/download/download_manager_impl.cc
@@ -99,9 +99,9 @@ void DeleteDownloadedFileOnUIThread(const base::FilePath& file_path) {
}
#endif
-StoragePartitionImpl* GetStoragePartition(BrowserContext* context,
- int render_process_id,
- int render_frame_id) {
+StoragePartition* GetStoragePartition(BrowserContext* context,
+ int render_process_id,
+ int render_frame_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
SiteInstance* site_instance = nullptr;
@@ -111,8 +111,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context,
if (render_frame_host_)
site_instance = render_frame_host_->GetSiteInstance();
}
- return static_cast<StoragePartitionImpl*>(
- BrowserContext::GetStoragePartition(context, site_instance));
+ return BrowserContext::GetStoragePartition(context, site_instance);
}
void OnDownloadStarted(
@@ -270,7 +269,7 @@ base::FilePath GetTemporaryDownloadDirectory() {
#endif
scoped_refptr<download::DownloadURLLoaderFactoryGetter>
-CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition,
+CreateDownloadURLLoaderFactoryGetter(StoragePartition* storage_partition,
RenderFrameHost* rfh,
bool is_download) {
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info;
@@ -287,7 +286,7 @@ CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition,
}
}
return base::MakeRefCounted<NetworkDownloadURLLoaderFactoryGetter>(
- storage_partition->url_loader_factory_getter(),
+ base::WrapRefCounted(storage_partition->url_loader_factory_getter()),
std::move(proxy_factory_ptr_info), std::move(proxy_factory_request));
}
@@ -1230,7 +1229,7 @@ void DownloadManagerImpl::InterceptNavigationOnChecksComplete(
tab_referrer_url = entry->GetReferrer().url;
}
}
- StoragePartitionImpl* storage_partition =
+ StoragePartition* storage_partition =
GetStoragePartition(browser_context_, render_process_id, render_frame_id);
in_progress_manager_->InterceptDownloadFromNavigation(
std::move(resource_request), render_process_id, render_frame_id, site_url,
@@ -1281,10 +1280,8 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete(
base::MakeRefCounted<WebUIDownloadURLLoaderFactoryGetter>(
rfh, params->url());
} else if (rfh && params->url().SchemeIsFileSystem()) {
- StoragePartitionImpl* storage_partition =
- static_cast<StoragePartitionImpl*>(
- BrowserContext::GetStoragePartitionForSite(browser_context_,
- site_url));
+ StoragePartition* storage_partition =
+ BrowserContext::GetStoragePartitionForSite(browser_context_, site_url);
std::string storage_domain;
auto* site_instance = rfh->GetSiteInstance();
if (site_instance) {
@@ -1299,10 +1296,8 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete(
params->url(), rfh, /*is_navigation=*/false,
storage_partition->GetFileSystemContext(), storage_domain);
} else {
- StoragePartitionImpl* storage_partition =
- static_cast<StoragePartitionImpl*>(
- BrowserContext::GetStoragePartitionForSite(browser_context_,
- site_url));
+ StoragePartition* storage_partition =
+ BrowserContext::GetStoragePartitionForSite(browser_context_, site_url);
url_loader_factory_getter =
CreateDownloadURLLoaderFactoryGetter(storage_partition, rfh, true);
}
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
index 81809b25675d..fe4b21a71091 100644
--- content/browser/loader/navigation_url_loader_impl.cc
+++ content/browser/loader/navigation_url_loader_impl.cc
@@ -387,7 +387,7 @@ class AboutURLLoaderFactory : public network::mojom::URLLoaderFactory {
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
CreateNetworkFactoryInfoWithHeaderClient(
network::mojom::TrustedURLLoaderHeaderClientPtrInfo header_client,
- StoragePartitionImpl* partition) {
+ StoragePartition* partition) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
network::mojom::URLLoaderFactoryPtrInfo factory_info;
network::mojom::URLLoaderFactoryParamsPtr params =
@@ -1267,7 +1267,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
// path does as well for navigations.
bool has_plugin = PluginService::GetInstance()->GetPluginInfo(
-1 /* render_process_id */, -1 /* render_frame_id */, resource_context_,
- resource_request_->url, url::Origin(), head.mime_type,
+ resource_request_->url, true, url::Origin(), head.mime_type,
false /* allow_wildcard */, &stale, &plugin, nullptr);
if (stale) {
@@ -1616,7 +1616,7 @@ NavigationURLLoaderImpl::NavigationURLLoaderImpl(
CreateResourceRequest(request_info.get(), frame_tree_node_id,
IsNavigationDownloadAllowed(download_policy_));
- auto* partition = static_cast<StoragePartitionImpl*>(storage_partition);
+ auto* partition = storage_partition;
scoped_refptr<SignedExchangePrefetchMetricRecorder>
signed_exchange_prefetch_metric_recorder =
partition->GetPrefetchURLLoaderService()
diff --git content/browser/payments/payment_app_installer.cc content/browser/payments/payment_app_installer.cc
index c2ee504cd0c7..422dc641d0a0 100644
--- content/browser/payments/payment_app_installer.cc
+++ content/browser/payments/payment_app_installer.cc
@@ -132,9 +132,9 @@ class SelfDeleteInstaller
void SetPaymentAppIntoDatabase() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
+ StoragePartition* partition =
BrowserContext::GetDefaultStoragePartition(
- web_contents()->GetBrowserContext()));
+ web_contents()->GetBrowserContext());
scoped_refptr<PaymentAppContextImpl> payment_app_context =
partition->GetPaymentAppContext();
diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc
index 9d3bee713440..38cc82d730a5 100644
--- content/browser/payments/payment_app_provider_impl.cc
+++ content/browser/payments/payment_app_provider_impl.cc
@@ -367,10 +367,11 @@ void StartServiceWorkerForDispatch(BrowserContext* browser_context,
ServiceWorkerStartCallback 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());
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
@@ -444,8 +445,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();
diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
index b33f30b3ec0d..9b78bdcd55b0 100644
--- content/browser/renderer_host/render_process_host_impl.cc
+++ content/browser/renderer_host/render_process_host_impl.cc
@@ -700,11 +700,10 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data,
// Gets the correct render process to use for this SiteInstance.
RenderProcessHost* GetProcessHost(SiteInstance* site_instance,
bool is_for_guests_only) {
- StoragePartitionImpl* default_partition =
- static_cast<StoragePartitionImpl*>(
- BrowserContext::GetDefaultStoragePartition(browser_context_));
- StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
- BrowserContext::GetStoragePartition(browser_context_, site_instance));
+ StoragePartition* default_partition =
+ BrowserContext::GetDefaultStoragePartition(browser_context_);
+ StoragePartition* partition =
+ BrowserContext::GetStoragePartition(browser_context_, site_instance);
// Is this the default storage partition? If it isn't, then just give it its
// own non-shared process.
@@ -1433,7 +1432,7 @@ int RenderProcessHost::GetCurrentRenderProcessCountForTesting() {
// static
RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
BrowserContext* browser_context,
- StoragePartitionImpl* storage_partition_impl,
+ StoragePartition* storage_partition_impl,
SiteInstance* site_instance,
bool is_for_guests_only) {
if (g_render_process_host_factory_) {
@@ -1442,8 +1441,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
}
if (!storage_partition_impl) {
- storage_partition_impl = static_cast<StoragePartitionImpl*>(
- BrowserContext::GetStoragePartition(browser_context, site_instance));
+ storage_partition_impl =
+ BrowserContext::GetStoragePartition(browser_context, site_instance);
}
// If we've made a StoragePartition for guests (e.g., for the <webview> tag),
// stash the Site URL on it. This way, when we start a service worker inside
@@ -1468,7 +1467,7 @@ const unsigned int RenderProcessHostImpl::kMaxFrameDepthForPriority =
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),
@@ -1503,10 +1502,12 @@ RenderProcessHostImpl::RenderProcessHostImpl(
permission_service_context_(new PermissionServiceContext(this)),
indexed_db_factory_(new IndexedDBDispatcherHost(
id_,
- storage_partition_impl_->GetIndexedDBContext(),
+ static_cast<IndexedDBContextImpl*>(
+ storage_partition_impl_->GetIndexedDBContext()),
ChromeBlobStorageContext::GetFor(browser_context_))),
service_worker_dispatcher_host_(new ServiceWorkerDispatcherHost(
- storage_partition_impl_->GetServiceWorkerContext(),
+ static_cast<ServiceWorkerContextWrapper*>(
+ storage_partition_impl_->GetServiceWorkerContext()),
id_)),
channel_connected_(false),
sent_render_process_ready_(false),
@@ -1539,7 +1540,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
}
push_messaging_manager_.reset(new PushMessagingManager(
- GetID(), storage_partition_impl_->GetServiceWorkerContext()));
+ GetID(), static_cast<ServiceWorkerContextWrapper*>(
+ storage_partition_impl_->GetServiceWorkerContext())));
AddObserver(indexed_db_factory_.get());
AddObserver(service_worker_dispatcher_host_.get());
@@ -1865,6 +1867,15 @@ void RenderProcessHostImpl::ResetChannelProxy() {
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 service_worker_context = static_cast<ServiceWorkerContextWrapper*>(
+ storage_partition_impl_->GetServiceWorkerContext());
+
MediaInternals* media_internals = MediaInternals::GetInstance();
// Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
// from guests.
@@ -1904,10 +1915,10 @@ void RenderProcessHostImpl::CreateMessageFilters() {
media_request_context));
resource_message_filter_ = new ResourceMessageFilter(
- GetID(), storage_partition_impl_->GetAppCacheService(),
+ GetID(), app_cache_service,
blob_storage_context.get(),
storage_partition_impl_->GetFileSystemContext(),
- storage_partition_impl_->GetServiceWorkerContext(),
+ service_worker_context,
storage_partition_impl_->GetPrefetchURLLoaderService(),
browser_context->GetSharedCorsOriginAccessList(),
std::move(get_contexts_callback),
@@ -1916,8 +1927,7 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(resource_message_filter_.get());
}
- AddFilter(new DOMStorageMessageFilter(
- storage_partition_impl_->GetDOMStorageContext()));
+ AddFilter(new DOMStorageMessageFilter(dom_storage_context));
peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID());
AddFilter(peer_connection_tracker_host_.get());
@@ -1934,10 +1944,6 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(new TraceMessageFilter(GetID()));
AddFilter(new ResolveProxyMsgHelper(GetID()));
-
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context(
- static_cast<ServiceWorkerContextWrapper*>(
- storage_partition_impl_->GetServiceWorkerContext()));
}
void RenderProcessHostImpl::BindCacheStorage(
@@ -1949,7 +1955,8 @@ void RenderProcessHostImpl::BindCacheStorage(
cache_storage_dispatcher_host_ =
base::MakeRefCounted<CacheStorageDispatcherHost>();
cache_storage_dispatcher_host_->Init(
- storage_partition_impl_->GetCacheStorageContext());
+ static_cast<CacheStorageContextImpl*>(
+ storage_partition_impl_->GetCacheStorageContext()));
}
// Send the binding to IO thread, because Cache Storage handles Mojo IPC on IO
// thread entirely.
@@ -2153,7 +2160,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
registry->AddInterface(base::BindRepeating(
&CodeCacheHostImpl::Create, GetID(),
- base::RetainedRef(storage_partition_impl_->GetCacheStorageContext()),
+ base::RetainedRef(static_cast<CacheStorageContextImpl*>(
+ storage_partition_impl_->GetCacheStorageContext())),
base::RetainedRef(
storage_partition_impl_->GetGeneratedCodeCacheContext())));
@@ -2165,7 +2173,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
registry->AddInterface(base::BindRepeating(
&ChromeAppCacheService::CreateBackend,
- base::Unretained(storage_partition_impl_->GetAppCacheService()),
+ base::Unretained(static_cast<ChromeAppCacheService*>(
+ storage_partition_impl_->GetAppCacheService())),
GetID()));
AddUIThreadInterface(
@@ -2211,6 +2220,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
plugin_registry_.reset(
new PluginRegistryImpl(GetBrowserContext()->GetResourceContext()));
}
+ // Needed for proper routing of IsPluginAvailable callbacks.
+ DCHECK_GE(GetID(), 0);
+ plugin_registry_->set_render_process_id(GetID());
registry->AddInterface(base::BindRepeating(
&PluginRegistryImpl::Bind, base::Unretained(plugin_registry_.get())));
#endif
diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h
index d5d82b53dd5e..080011133034 100644
--- content/browser/renderer_host/render_process_host_impl.h
+++ content/browser/renderer_host/render_process_host_impl.h
@@ -101,7 +101,6 @@ class ServiceWorkerDispatcherHost;
class SiteInstance;
class SiteInstanceImpl;
class StoragePartition;
-class StoragePartitionImpl;
struct ChildProcessTerminationInfo;
typedef base::Thread* (*RendererMainThreadFactoryFunction)(
@@ -143,7 +142,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
// null.
static RenderProcessHost* CreateRenderProcessHost(
BrowserContext* browser_context,
- StoragePartitionImpl* storage_partition_impl,
+ StoragePartition* storage_partition_impl,
SiteInstance* site_instance,
bool is_for_guests_only);
@@ -516,7 +515,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
// Use CreateRenderProcessHost() instead of calling this constructor
// directly.
RenderProcessHostImpl(BrowserContext* browser_context,
- StoragePartitionImpl* storage_partition_impl,
+ StoragePartition* storage_partition_impl,
bool is_for_guests_only);
// Initializes a new IPC::ChannelProxy in |channel_|, which will be connected
@@ -782,10 +781,10 @@ class CONTENT_EXPORT RenderProcessHostImpl
// The globally-unique identifier for this RPH.
const int id_;
- BrowserContext* const browser_context_;
+ BrowserContext* browser_context_;
// Owned by |browser_context_|.
- StoragePartitionImpl* storage_partition_impl_;
+ StoragePartition* storage_partition_impl_;
// Keeps track of the BindingIds returned by storage_partition_impl_->Bind()
// calls so we can Unbind() them on cleanup.
diff --git content/browser/renderer_interface_binders.cc content/browser/renderer_interface_binders.cc
index 8e4df0b15aeb..02bcdca69af9 100644
--- content/browser/renderer_interface_binders.cc
+++ content/browser/renderer_interface_binders.cc
@@ -140,7 +140,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
parameterized_binder_registry_.AddInterface(
base::Bind([](payments::mojom::PaymentManagerRequest request,
RenderProcessHost* host, const url::Origin& origin) {
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
+ host->GetStoragePartition()
->GetPaymentAppContext()
->CreatePaymentManager(std::move(request));
}));
@@ -173,23 +173,23 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
parameterized_binder_registry_.AddInterface(base::BindRepeating(
[](blink::mojom::LockManagerRequest request, RenderProcessHost* host,
const url::Origin& origin) {
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
+ host->GetStoragePartition()
->GetLockManager()
->CreateService(std::move(request), origin);
}));
parameterized_binder_registry_.AddInterface(base::BindRepeating(
[](blink::mojom::IdleManagerRequest request, RenderProcessHost* host,
const url::Origin& origin) {
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
+ host->GetStoragePartition()
->GetIdleManager()
->CreateService(std::move(request), origin);
}));
parameterized_binder_registry_.AddInterface(
base::Bind([](blink::mojom::NotificationServiceRequest request,
RenderProcessHost* host, const url::Origin& origin) {
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
- ->GetPlatformNotificationContext()
- ->CreateService(origin, std::move(request));
+ static_cast<PlatformNotificationContextImpl*>(
+ host->GetStoragePartition()->GetPlatformNotificationContext())
+ ->CreateService(origin, std::move(request));
}));
parameterized_binder_registry_.AddInterface(
base::BindRepeating(&BackgroundFetchServiceImpl::CreateForWorker));
@@ -200,7 +200,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
parameterized_binder_registry_.AddInterface(base::BindRepeating(
[](blink::mojom::CookieStoreRequest request, RenderProcessHost* host,
const url::Origin& origin) {
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
+ host->GetStoragePartition()
->GetCookieStoreContext()
->CreateService(std::move(request), origin);
}));
diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h
index afc09164afd8..8b6e2cacc9d2 100644
--- content/browser/storage_partition_impl.h
+++ content/browser/storage_partition_impl.h
@@ -98,8 +98,8 @@ class CONTENT_EXPORT StoragePartitionImpl
storage::FileSystemContext* GetFileSystemContext() override;
storage::DatabaseTracker* GetDatabaseTracker() override;
DOMStorageContextWrapper* GetDOMStorageContext() override;
- IdleManager* GetIdleManager();
- LockManager* GetLockManager(); // override; TODO: Add to interface
+ IdleManager* GetIdleManager() override;
+ LockManager* GetLockManager() override;
IndexedDBContextImpl* GetIndexedDBContext() override;
CacheStorageContextImpl* GetCacheStorageContext() override;
ServiceWorkerContextWrapper* GetServiceWorkerContext() override;
@@ -144,15 +144,16 @@ class CONTENT_EXPORT StoragePartitionImpl
void FlushNetworkInterfaceForTesting() override;
void WaitForDeletionTasksForTesting() override;
- BackgroundFetchContext* GetBackgroundFetchContext();
- BackgroundSyncContext* GetBackgroundSyncContext();
- PaymentAppContextImpl* GetPaymentAppContext();
- BroadcastChannelProvider* GetBroadcastChannelProvider();
- BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap();
- BlobRegistryWrapper* GetBlobRegistry();
- PrefetchURLLoaderService* GetPrefetchURLLoaderService();
- CookieStoreContext* GetCookieStoreContext();
- DevToolsBackgroundServicesContext* GetDevToolsBackgroundServicesContext();
+ BackgroundFetchContext* GetBackgroundFetchContext() override;
+ BackgroundSyncContext* GetBackgroundSyncContext() override;
+ PaymentAppContextImpl* GetPaymentAppContext() override;
+ BroadcastChannelProvider* GetBroadcastChannelProvider() override;
+ BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
+ BlobRegistryWrapper* GetBlobRegistry() override;
+ PrefetchURLLoaderService* GetPrefetchURLLoaderService() override;
+ CookieStoreContext* GetCookieStoreContext() override;
+ DevToolsBackgroundServicesContext* GetDevToolsBackgroundServicesContext()
+ override;
// blink::mojom::StoragePartitionService interface.
void OpenLocalStorage(const url::Origin& origin,
@@ -170,21 +171,22 @@ class CONTENT_EXPORT StoragePartitionImpl
const GURL& origin,
OnCanSendDomainReliabilityUploadCallback callback) override;
- 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;
// Called by each renderer process for each StoragePartitionService interface
// it binds in the renderer process. Returns the id of the created binding.
mojo::BindingId Bind(
int process_id,
- mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request);
+ mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request)
+ override;
// Remove a binding created by a previous Bind() call.
- void Unbind(mojo::BindingId binding_id);
+ void Unbind(mojo::BindingId binding_id) override;
auto& bindings_for_testing() { return bindings_; }
@@ -195,10 +197,11 @@ class CONTENT_EXPORT StoragePartitionImpl
// one must use the "chrome-guest://blahblah" site URL to ensure that the
// service worker stays in this StoragePartition. This is an empty GURL if
// this StoragePartition is not for guests.
- void set_site_for_service_worker(const GURL& site_for_service_worker) {
+ void set_site_for_service_worker(
+ const GURL& site_for_service_worker) override {
site_for_service_worker_ = site_for_service_worker;
}
- const GURL& site_for_service_worker() const {
+ const GURL& site_for_service_worker() const override {
return site_for_service_worker_;
}
diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc
index 9ed67fe1550b..d0c791791c38 100644
--- content/browser/streams/stream_context.cc
+++ content/browser/streams/stream_context.cc
@@ -23,6 +23,11 @@ namespace content {
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 075ae3e7431e..57fb5fd2c4a8 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();
diff --git content/browser/webui/web_ui_url_loader_factory.cc content/browser/webui/web_ui_url_loader_factory.cc
index 63fe0125ca1c..698378600723 100644
--- content/browser/webui/web_ui_url_loader_factory.cc
+++ content/browser/webui/web_ui_url_loader_factory.cc
@@ -19,7 +19,6 @@
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/frame_host/render_frame_host_impl.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"
@@ -27,6 +26,7 @@
#include "content/public/browser/browser_task_traits.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/browser/web_contents_observer.h"
#include "content/public/common/url_constants.h"
@@ -314,9 +314,8 @@ class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory,
const std::string& scheme() const { return scheme_; }
private:
- StoragePartitionImpl* GetStoragePartition() {
- return static_cast<StoragePartitionImpl*>(
- render_frame_host_->GetProcess()->GetStoragePartition());
+ StoragePartition* GetStoragePartition() {
+ return render_frame_host_->GetProcess()->GetStoragePartition();
}
RenderFrameHost* render_frame_host_;
diff --git content/browser/worker_host/dedicated_worker_host.cc content/browser/worker_host/dedicated_worker_host.cc
index d0eae9ed2150..edf0c88464d8 100644
--- content/browser/worker_host/dedicated_worker_host.cc
+++ content/browser/worker_host/dedicated_worker_host.cc
@@ -77,8 +77,7 @@ class DedicatedWorkerHost : public service_manager::mojom::InterfaceProvider {
client->OnScriptLoadFailed();
return;
}
- auto* storage_partition_impl = static_cast<StoragePartitionImpl*>(
- render_process_host->GetStoragePartition());
+ auto* storage_partition_impl = render_process_host->GetStoragePartition();
scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory;
if (blob_url_token) {
@@ -93,11 +92,13 @@ class DedicatedWorkerHost : public service_manager::mojom::InterfaceProvider {
}
appcache_handle_ = std::make_unique<AppCacheNavigationHandle>(
- storage_partition_impl->GetAppCacheService(), process_id_);
+ static_cast<ChromeAppCacheService*>(
+ storage_partition_impl->GetAppCacheService()), process_id_);
WorkerScriptFetchInitiator::Start(
process_id_, script_url, request_initiator_origin, RESOURCE_TYPE_WORKER,
- storage_partition_impl->GetServiceWorkerContext(),
+ static_cast<ServiceWorkerContextWrapper*>(
+ storage_partition_impl->GetServiceWorkerContext()),
appcache_handle_->core(), std::move(blob_url_loader_factory),
storage_partition_impl,
base::BindOnce(&DedicatedWorkerHost::DidLoadDedicatedWorker,
@@ -141,8 +142,7 @@ class DedicatedWorkerHost : public service_manager::mojom::InterfaceProvider {
client->OnScriptLoadFailed();
return;
}
- auto* storage_partition_impl = static_cast<StoragePartitionImpl*>(
- render_process_host->GetStoragePartition());
+ auto* storage_partition_impl = render_process_host->GetStoragePartition();
// Set up the default network loader factory.
network::mojom::URLLoaderFactoryPtrInfo default_factory_info;
diff --git content/browser/worker_host/shared_worker_connector_impl.cc content/browser/worker_host/shared_worker_connector_impl.cc
index 4b410f1384b0..299e9402b93d 100644
--- content/browser/worker_host/shared_worker_connector_impl.cc
+++ content/browser/worker_host/shared_worker_connector_impl.cc
@@ -53,8 +53,8 @@ void SharedWorkerConnectorImpl::Connect(
host->GetBrowserContext(), std::move(blob_url_token));
}
SharedWorkerServiceImpl* service =
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
- ->GetSharedWorkerService();
+ static_cast<SharedWorkerServiceImpl*>(host->GetStoragePartition()
+ ->GetSharedWorkerService());
service->ConnectToWorker(process_id_, frame_id_, std::move(info),
std::move(client), creation_context_type,
blink::MessagePortChannel(std::move(message_port)),
diff --git content/browser/worker_host/worker_script_fetch_initiator.cc content/browser/worker_host/worker_script_fetch_initiator.cc
index a8f396c70a7b..ba94144b93e0 100644
--- content/browser/worker_host/worker_script_fetch_initiator.cc
+++ content/browser/worker_host/worker_script_fetch_initiator.cc
@@ -11,11 +11,11 @@
#include "base/macros.h"
#include "base/metrics/field_trial_params.h"
#include "base/task/post_task.h"
+#include "content/browser/appcache/appcache_host.h"
#include "content/browser/appcache/appcache_navigation_handle.h"
#include "content/browser/appcache/appcache_navigation_handle_core.h"
#include "content/browser/file_url_loader_factory.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
-#include "content/browser/storage_partition_impl.h"
#include "content/browser/url_loader_factory_getter.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/worker_host/worker_script_fetcher.h"
@@ -23,12 +23,14 @@
#include "content/browser/worker_host/worker_script_loader_factory.h"
#include "content/common/content_constants_internal.h"
#include "content/common/navigation_subresource_loader_params.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/shared_cors_origin_access_list.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/origin_util.h"
@@ -53,7 +55,7 @@ void WorkerScriptFetchInitiator::Start(
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
AppCacheNavigationHandleCore* appcache_handle_core,
scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
- StoragePartitionImpl* storage_partition,
+ StoragePartition* storage_partition,
CompletionCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(blink::ServiceWorkerUtils::IsServicificationEnabled());
@@ -99,7 +101,7 @@ void WorkerScriptFetchInitiator::Start(
base::BindOnce(
&WorkerScriptFetchInitiator::CreateScriptLoaderOnIO, process_id,
std::move(resource_request),
- storage_partition->url_loader_factory_getter(),
+ base::WrapRefCounted(storage_partition->url_loader_factory_getter()),
std::move(factory_bundle_for_browser),
std::move(subresource_loader_factories),
std::move(service_worker_context), appcache_handle_core,
@@ -110,7 +112,7 @@ void WorkerScriptFetchInitiator::Start(
std::unique_ptr<blink::URLLoaderFactoryBundleInfo>
WorkerScriptFetchInitiator::CreateFactoryBundle(
int process_id,
- StoragePartitionImpl* storage_partition,
+ StoragePartition* storage_partition,
bool file_support) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(blink::ServiceWorkerUtils::IsServicificationEnabled());
diff --git content/browser/worker_host/worker_script_fetch_initiator.h content/browser/worker_host/worker_script_fetch_initiator.h
index 8bf63d954554..47a03e2d3364 100644
--- content/browser/worker_host/worker_script_fetch_initiator.h
+++ content/browser/worker_host/worker_script_fetch_initiator.h
@@ -32,7 +32,7 @@ namespace content {
class AppCacheNavigationHandleCore;
class BrowserContext;
class ServiceWorkerContextWrapper;
-class StoragePartitionImpl;
+class StoragePartition;
class URLLoaderFactoryGetter;
struct SubresourceLoaderParams;
@@ -59,14 +59,14 @@ class WorkerScriptFetchInitiator {
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
AppCacheNavigationHandleCore* appcache_handle_core,
scoped_refptr<network::SharedURLLoaderFactory> blob_url_loader_factory,
- StoragePartitionImpl* storage_partition,
+ StoragePartition* storage_partition,
CompletionCallback callback);
private:
// Creates a loader factory bundle. Must be called on the UI thread.
static std::unique_ptr<blink::URLLoaderFactoryBundleInfo> CreateFactoryBundle(
int process_id,
- StoragePartitionImpl* storage_partition,
+ StoragePartition* storage_partition,
bool file_support);
// Adds additional request headers to |resource_request|. Must be called on
diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h
index 0a6913f2ca56..31bda5a84c31 100644
--- content/public/browser/browser_context.h
+++ content/public/browser/browser_context.h
@@ -227,6 +227,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
BrowserContext();
+ static const void* GetStoragePartitionMapUserDataKey();
+
~BrowserContext() override;
// Shuts down the storage partitions associated to this browser context.
@@ -362,6 +364,13 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData {
virtual download::InProgressDownloadManager*
RetriveInProgressDownloadManager();
+ // 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;
+ }
private:
const std::string unique_id_;
bool was_notify_will_be_destroyed_called_ = false;
diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h
index 911c9e347c33..6f97bbd947a9 100644
--- content/public/browser/storage_partition.h
+++ content/public/browser/storage_partition.h
@@ -14,8 +14,10 @@
#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 "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/cookie_manager.mojom-forward.h"
+#include "third_party/blink/public/mojom/dom_storage/storage_partition_service.mojom.h"
class GURL;
@@ -59,12 +61,30 @@ class PlatformNotificationContext;
class ServiceWorkerContext;
class SharedWorkerService;
+class BackgroundFetchContext;
+class BackgroundSyncContext;
+class BlobRegistryWrapper;
+class BlobURLLoaderFactory;
+class BluetoothAllowedDevicesMap;
+class BroadcastChannelProvider;
+class CookieStoreContext;
+class DevToolsBackgroundServicesContext;
+class IdleManager;
+class LockManager;
+class PaymentAppContextImpl;
+class PrefetchURLLoaderService;
+class URLLoaderFactoryGetter;
+
#if !defined(OS_ANDROID)
class HostZoomLevelContext;
class HostZoomMap;
class ZoomLevelDelegate;
#endif // !defined(OS_ANDROID)
2017-02-14 11:47:27 -05:00
+namespace mojom {
+class StoragePartitionService;
+}
+
// Defines what persistent state a child process can access.
//
// The StoragePartition defines the view each child process has of the
@@ -104,6 +124,8 @@ class CONTENT_EXPORT StoragePartition {
virtual storage::FileSystemContext* GetFileSystemContext() = 0;
virtual storage::DatabaseTracker* GetDatabaseTracker() = 0;
virtual DOMStorageContext* GetDOMStorageContext() = 0;
+ virtual IdleManager* GetIdleManager() = 0;
+ virtual LockManager* GetLockManager() = 0;
virtual IndexedDBContext* GetIndexedDBContext() = 0;
virtual ServiceWorkerContext* GetServiceWorkerContext() = 0;
virtual SharedWorkerService* GetSharedWorkerService() = 0;
@@ -239,6 +261,30 @@ class CONTENT_EXPORT StoragePartition {
// Wait until all deletions tasks are finished. For test use only.
virtual void WaitForDeletionTasksForTesting() = 0;
+ virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0;
+ virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0;
+ virtual PaymentAppContextImpl* GetPaymentAppContext() = 0;
+ virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0;
+ virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0;
+ virtual BlobRegistryWrapper* GetBlobRegistry() = 0;
+ virtual PrefetchURLLoaderService* GetPrefetchURLLoaderService() = 0;
+ virtual CookieStoreContext* GetCookieStoreContext() = 0;
+ virtual DevToolsBackgroundServicesContext*
+ GetDevToolsBackgroundServicesContext() = 0;
+
+ virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0;
+ virtual BrowserContext* browser_context() const = 0;
+
+ virtual mojo::BindingId Bind(
+ int process_id,
+ mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request) = 0;
+
+ virtual void Unbind(mojo::BindingId binding_id) = 0;
+
+ virtual void set_site_for_service_worker(
+ const GURL& site_for_service_worker) = 0;
+ virtual const GURL& site_for_service_worker() const = 0;
+
protected:
virtual ~StoragePartition() {}
};
diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc
index 18f8b0a11438..a10ab23aaceb 100644
--- storage/browser/database/database_tracker.cc
+++ storage/browser/database/database_tracker.cc
@@ -509,7 +509,7 @@ bool DatabaseTracker::LazyInit() {
meta_table_.reset(new sql::MetaTable());
is_initialized_ =
- base::CreateDirectory(db_dir_) &&
+ (is_incognito_ ? true : base::CreateDirectory(db_dir_)) &&
(db_->is_open() ||
(is_incognito_ ? db_->OpenInMemory() :
db_->Open(kTrackerDatabaseFullPath))) &&