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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 2906543002: Add support for reading blobs when using the network service. (Closed)
Patch Set: fix threading issue with weakptr Created 3 years, 6 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
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/url_loader_factory_getter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 01dc70688f27b2b916a3fbd5694569667fabb006..dbea3089dcedd5db9aadf7a77f1ca91fa4c4a054 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -15,6 +15,7 @@
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
+#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/browsing_data/storage_partition_http_cache_data_remover.h"
#include "content/browser/fileapi/browser_file_system_helper.h"
@@ -40,6 +41,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "ppapi/features/features.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/database/database_tracker.h"
#include "storage/browser/quota/quota_manager.h"
@@ -230,6 +232,12 @@ void ClearSessionStorageOnUIThread(
callback));
}
+base::WeakPtr<storage::BlobStorageContext> BlobStorageContextGetter(
+ scoped_refptr<ChromeBlobStorageContext> blob_context) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ return blob_context->context()->AsWeakPtr();
+}
+
} // namespace
// Static.
@@ -529,6 +537,13 @@ std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create(
network_service->CreateNetworkContext(
MakeRequest(&partition->network_context_), std::move(context_params));
+ scoped_refptr<ChromeBlobStorageContext> blob_context =
+ ChromeBlobStorageContext::GetFor(context);
+ BlobURLLoaderFactory::BlobContextGetter blob_getter =
+ base::BindOnce(&BlobStorageContextGetter, blob_context);
+ partition->blob_url_loader_factory_ = new BlobURLLoaderFactory(
+ std::move(blob_getter), partition->filesystem_context_);
+
partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter();
partition->url_loader_factory_getter_->Initialize(partition.get());
}
@@ -623,6 +638,10 @@ StoragePartitionImpl::GetBluetoothAllowedDevicesMap() {
return bluetooth_allowed_devices_map_.get();
}
+BlobURLLoaderFactory* StoragePartitionImpl::GetBlobURLLoaderFactory() {
+ return blob_url_loader_factory_.get();
+}
+
void StoragePartitionImpl::OpenLocalStorage(
const url::Origin& origin,
mojo::InterfaceRequest<mojom::LevelDBWrapper> request) {
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/url_loader_factory_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698