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

Unified Diff: content/browser/service_worker/service_worker_cache_storage_manager.cc

Issue 459003002: Plumbs URLRequestContext and CacheBlobStorageContext down to cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache1
Patch Set: nits Created 6 years, 4 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/service_worker/service_worker_cache_storage_manager.cc
diff --git a/content/browser/service_worker/service_worker_cache_storage_manager.cc b/content/browser/service_worker/service_worker_cache_storage_manager.cc
index b8ae678dcc38b1bd8c31806720da017d3c7325b1..0e75354035afe5945f9ed63c08823192e2cd5f3f 100644
--- a/content/browser/service_worker/service_worker_cache_storage_manager.cc
+++ b/content/browser/service_worker/service_worker_cache_storage_manager.cc
@@ -50,8 +50,14 @@ ServiceWorkerCacheStorageManager::Create(
scoped_ptr<ServiceWorkerCacheStorageManager>
ServiceWorkerCacheStorageManager::Create(
ServiceWorkerCacheStorageManager* old_manager) {
- return make_scoped_ptr(new ServiceWorkerCacheStorageManager(
- old_manager->root_path(), old_manager->cache_task_runner()));
+ scoped_ptr<ServiceWorkerCacheStorageManager> manager(
+ new ServiceWorkerCacheStorageManager(old_manager->root_path(),
+ old_manager->cache_task_runner()));
+ // These values may be NULL, in which case this will be called again later by
+ // the dispatcher host per usual.
+ manager->SetBlobParametersForCache(old_manager->url_request_context(),
+ old_manager->blob_storage_context());
+ return manager.Pass();
}
ServiceWorkerCacheStorageManager::~ServiceWorkerCacheStorageManager() {
@@ -119,16 +125,30 @@ void ServiceWorkerCacheStorageManager::EnumerateCaches(
cache_storage->EnumerateCaches(callback);
}
+void ServiceWorkerCacheStorageManager::SetBlobParametersForCache(
+ net::URLRequestContext* request_context,
+ base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(cache_storage_map_.empty());
+ DCHECK(!request_context_ || request_context_ == request_context);
+ DCHECK(!blob_context_ || blob_context_.get() == blob_storage_context.get());
+ request_context_ = request_context;
+ blob_context_ = blob_storage_context;
+}
+
ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager(
const base::FilePath& path,
base::SequencedTaskRunner* cache_task_runner)
- : root_path_(path), cache_task_runner_(cache_task_runner) {
+ : root_path_(path),
+ cache_task_runner_(cache_task_runner),
+ request_context_(NULL) {
}
ServiceWorkerCacheStorage*
ServiceWorkerCacheStorageManager::FindOrCreateServiceWorkerCacheManager(
const GURL& origin) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(request_context_);
ServiceWorkerCacheStorageMap::const_iterator it =
cache_storage_map_.find(origin);
@@ -137,7 +157,9 @@ ServiceWorkerCacheStorageManager::FindOrCreateServiceWorkerCacheManager(
ServiceWorkerCacheStorage* cache_storage =
new ServiceWorkerCacheStorage(ConstructOriginPath(root_path_, origin),
memory_only,
- cache_task_runner_);
+ cache_task_runner_,
+ request_context_,
+ blob_context_);
// The map owns fetch_stores.
cache_storage_map_.insert(std::make_pair(origin, cache_storage));
return cache_storage;

Powered by Google App Engine
This is Rietveld 408576698