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

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

Issue 444333006: Rename ServiceWorkerFetchStore/FetchStores/FetchStoresManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fetch_stores3
Patch Set: Rebase 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_fetch_stores_manager.cc b/content/browser/service_worker/service_worker_cache_storage_manager.cc
similarity index 32%
rename from content/browser/service_worker/service_worker_fetch_stores_manager.cc
rename to content/browser/service_worker/service_worker_cache_storage_manager.cc
index f1ae8dbcb6319d52b830405c96dc90c4c581d9f3..034ce93b7d402941a7ecabe46a12c1efbf908cb4 100644
--- a/content/browser/service_worker/service_worker_fetch_stores_manager.cc
+++ b/content/browser/service_worker/service_worker_cache_storage_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/service_worker/service_worker_fetch_stores_manager.h"
+#include "content/browser/service_worker/service_worker_cache_storage_manager.h"
#include <map>
#include <string>
@@ -12,8 +12,8 @@
#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "content/browser/service_worker/service_worker_cache_storage.h"
#include "content/browser/service_worker/service_worker_context_core.h"
-#include "content/browser/service_worker/service_worker_fetch_stores.h"
#include "content/public/browser/browser_thread.h"
#include "url/gurl.h"
@@ -32,137 +32,136 @@ base::FilePath ConstructOriginPath(const base::FilePath& root_path,
namespace content {
// static
-scoped_ptr<ServiceWorkerFetchStoresManager>
-ServiceWorkerFetchStoresManager::Create(
+scoped_ptr<ServiceWorkerCacheStorageManager>
+ServiceWorkerCacheStorageManager::Create(
const base::FilePath& path,
- base::SequencedTaskRunner* stores_task_runner) {
+ base::SequencedTaskRunner* cache_task_runner) {
base::FilePath root_path = path;
if (!path.empty()) {
root_path = path.Append(ServiceWorkerContextCore::kServiceWorkerDirectory)
- .AppendASCII("Stores");
+ .AppendASCII("CacheStorage");
}
return make_scoped_ptr(
- new ServiceWorkerFetchStoresManager(root_path, stores_task_runner));
+ new ServiceWorkerCacheStorageManager(root_path, cache_task_runner));
}
// static
-scoped_ptr<ServiceWorkerFetchStoresManager>
-ServiceWorkerFetchStoresManager::Create(
- ServiceWorkerFetchStoresManager* old_manager) {
- return make_scoped_ptr(new ServiceWorkerFetchStoresManager(
- old_manager->root_path(), old_manager->stores_task_runner()));
+scoped_ptr<ServiceWorkerCacheStorageManager>
+ServiceWorkerCacheStorageManager::Create(
+ ServiceWorkerCacheStorageManager* old_manager) {
+ return make_scoped_ptr(new ServiceWorkerCacheStorageManager(
+ old_manager->root_path(), old_manager->cache_task_runner()));
}
-ServiceWorkerFetchStoresManager::~ServiceWorkerFetchStoresManager() {
- for (ServiceWorkerFetchStoresMap::iterator it =
- service_worker_fetch_stores_.begin();
- it != service_worker_fetch_stores_.end();
+ServiceWorkerCacheStorageManager::~ServiceWorkerCacheStorageManager() {
+ for (ServiceWorkerCacheStorageMap::iterator it = cache_storage_map_.begin();
+ it != cache_storage_map_.end();
++it) {
- stores_task_runner_->DeleteSoon(FROM_HERE, it->second);
+ cache_task_runner_->DeleteSoon(FROM_HERE, it->second);
}
}
-void ServiceWorkerFetchStoresManager::CreateStore(
+void ServiceWorkerCacheStorageManager::CreateCache(
const GURL& origin,
- const std::string& store_name,
- const ServiceWorkerFetchStores::StoreAndErrorCallback& callback) {
+ const std::string& cache_name,
+ const ServiceWorkerCacheStorage::CacheAndErrorCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStores* stores =
- FindOrCreateServiceWorkerFetchStores(origin);
+ ServiceWorkerCacheStorage* cache_storage =
+ FindOrCreateServiceWorkerCacheManager(origin);
- stores_task_runner_->PostTask(
+ cache_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&ServiceWorkerFetchStores::CreateStore,
- base::Unretained(stores),
- store_name,
+ base::Bind(&ServiceWorkerCacheStorage::CreateCache,
+ base::Unretained(cache_storage),
+ cache_name,
callback));
}
-void ServiceWorkerFetchStoresManager::GetStore(
+void ServiceWorkerCacheStorageManager::GetCache(
const GURL& origin,
- const std::string& store_name,
- const ServiceWorkerFetchStores::StoreAndErrorCallback& callback) {
+ const std::string& cache_name,
+ const ServiceWorkerCacheStorage::CacheAndErrorCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStores* stores =
- FindOrCreateServiceWorkerFetchStores(origin);
- stores_task_runner_->PostTask(FROM_HERE,
- base::Bind(&ServiceWorkerFetchStores::GetStore,
- base::Unretained(stores),
- store_name,
- callback));
+ ServiceWorkerCacheStorage* cache_storage =
+ FindOrCreateServiceWorkerCacheManager(origin);
+ cache_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&ServiceWorkerCacheStorage::GetCache,
+ base::Unretained(cache_storage),
+ cache_name,
+ callback));
}
-void ServiceWorkerFetchStoresManager::HasStore(
+void ServiceWorkerCacheStorageManager::HasCache(
const GURL& origin,
- const std::string& store_name,
- const ServiceWorkerFetchStores::BoolAndErrorCallback& callback) {
+ const std::string& cache_name,
+ const ServiceWorkerCacheStorage::BoolAndErrorCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStores* stores =
- FindOrCreateServiceWorkerFetchStores(origin);
- stores_task_runner_->PostTask(FROM_HERE,
- base::Bind(&ServiceWorkerFetchStores::HasStore,
- base::Unretained(stores),
- store_name,
- callback));
+ ServiceWorkerCacheStorage* cache_storage =
+ FindOrCreateServiceWorkerCacheManager(origin);
+ cache_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&ServiceWorkerCacheStorage::HasCache,
+ base::Unretained(cache_storage),
+ cache_name,
+ callback));
}
-void ServiceWorkerFetchStoresManager::DeleteStore(
+void ServiceWorkerCacheStorageManager::DeleteCache(
const GURL& origin,
- const std::string& store_name,
- const ServiceWorkerFetchStores::BoolAndErrorCallback& callback) {
+ const std::string& cache_name,
+ const ServiceWorkerCacheStorage::BoolAndErrorCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStores* stores =
- FindOrCreateServiceWorkerFetchStores(origin);
- stores_task_runner_->PostTask(
+ ServiceWorkerCacheStorage* cache_storage =
+ FindOrCreateServiceWorkerCacheManager(origin);
+ cache_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&ServiceWorkerFetchStores::DeleteStore,
- base::Unretained(stores),
- store_name,
+ base::Bind(&ServiceWorkerCacheStorage::DeleteCache,
+ base::Unretained(cache_storage),
+ cache_name,
callback));
}
-void ServiceWorkerFetchStoresManager::EnumerateStores(
+void ServiceWorkerCacheStorageManager::EnumerateCaches(
const GURL& origin,
- const ServiceWorkerFetchStores::StringsAndErrorCallback& callback) {
+ const ServiceWorkerCacheStorage::StringsAndErrorCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStores* stores =
- FindOrCreateServiceWorkerFetchStores(origin);
+ ServiceWorkerCacheStorage* cache_storage =
+ FindOrCreateServiceWorkerCacheManager(origin);
- stores_task_runner_->PostTask(
+ cache_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&ServiceWorkerFetchStores::EnumerateStores,
- base::Unretained(stores),
+ base::Bind(&ServiceWorkerCacheStorage::EnumerateCaches,
+ base::Unretained(cache_storage),
callback));
}
-ServiceWorkerFetchStoresManager::ServiceWorkerFetchStoresManager(
+ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager(
const base::FilePath& path,
- base::SequencedTaskRunner* stores_task_runner)
- : root_path_(path), stores_task_runner_(stores_task_runner) {
+ base::SequencedTaskRunner* cache_task_runner)
+ : root_path_(path), cache_task_runner_(cache_task_runner) {
}
-ServiceWorkerFetchStores*
-ServiceWorkerFetchStoresManager::FindOrCreateServiceWorkerFetchStores(
+ServiceWorkerCacheStorage*
+ServiceWorkerCacheStorageManager::FindOrCreateServiceWorkerCacheManager(
const GURL& origin) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- ServiceWorkerFetchStoresMap::const_iterator it =
- service_worker_fetch_stores_.find(origin);
- if (it == service_worker_fetch_stores_.end()) {
+ ServiceWorkerCacheStorageMap::const_iterator it =
+ cache_storage_map_.find(origin);
+ if (it == cache_storage_map_.end()) {
bool memory_only = root_path_.empty();
- ServiceWorkerFetchStores* fetch_stores =
- new ServiceWorkerFetchStores(ConstructOriginPath(root_path_, origin),
- memory_only,
- base::MessageLoopProxy::current());
+ ServiceWorkerCacheStorage* cache_storage =
+ new ServiceWorkerCacheStorage(ConstructOriginPath(root_path_, origin),
+ memory_only,
+ base::MessageLoopProxy::current());
// The map owns fetch_stores.
- service_worker_fetch_stores_.insert(std::make_pair(origin, fetch_stores));
- return fetch_stores;
+ cache_storage_map_.insert(std::make_pair(origin, cache_storage));
+ return cache_storage;
}
return it->second;
}

Powered by Google App Engine
This is Rietveld 408576698