| Index: content/browser/cache_storage/cache_storage_listener.h
|
| diff --git a/content/browser/service_worker/service_worker_cache_listener.h b/content/browser/cache_storage/cache_storage_listener.h
|
| similarity index 58%
|
| rename from content/browser/service_worker/service_worker_cache_listener.h
|
| rename to content/browser/cache_storage/cache_storage_listener.h
|
| index 2fac7b532568dc83b6806a8b7305c04e91701e0a..a60e7a681dce4a2d49b41d7bf9dfa8e72f6c141b 100644
|
| --- a/content/browser/service_worker/service_worker_cache_listener.h
|
| +++ b/content/browser/cache_storage/cache_storage_listener.h
|
| @@ -2,32 +2,32 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
|
| -#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
|
| +#ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_LISTENER_H_
|
| +#define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_LISTENER_H_
|
|
|
| #include <list>
|
| #include <map>
|
|
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/strings/string16.h"
|
| -#include "content/browser/service_worker/cache_storage_dispatcher_host.h"
|
| -#include "content/browser/service_worker/service_worker_cache.h"
|
| -#include "content/browser/service_worker/service_worker_cache_storage.h"
|
| +#include "content/browser/cache_storage/cache_storage.h"
|
| +#include "content/browser/cache_storage/cache_storage_cache.h"
|
| +#include "content/browser/cache_storage/cache_storage_dispatcher_host.h"
|
|
|
| namespace content {
|
|
|
| -struct ServiceWorkerBatchOperation;
|
| -struct ServiceWorkerCacheQueryParams;
|
| +struct CacheStorageBatchOperation;
|
| +struct CacheStorageCacheQueryParams;
|
| struct ServiceWorkerFetchRequest;
|
|
|
| // This class listens for requests on the Cache APIs, and sends response
|
| // messages to the renderer process. There is one instance per
|
| // CacheStorageDispatcherHost instance.
|
| -class ServiceWorkerCacheListener {
|
| +class CacheStorageListener {
|
| public:
|
| - ServiceWorkerCacheListener(CacheStorageDispatcherHost* dispatcher,
|
| - CacheStorageContextImpl* context);
|
| - ~ServiceWorkerCacheListener();
|
| + CacheStorageListener(CacheStorageDispatcherHost* dispatcher,
|
| + CacheStorageContextImpl* context);
|
| + ~CacheStorageListener();
|
|
|
| bool OnMessageReceived(const IPC::Message& message);
|
|
|
| @@ -58,74 +58,69 @@ class ServiceWorkerCacheListener {
|
| int request_id,
|
| const GURL& origin,
|
| const ServiceWorkerFetchRequest& request,
|
| - const ServiceWorkerCacheQueryParams& match_params);
|
| + const CacheStorageCacheQueryParams& match_params);
|
|
|
| // The message receiver functions for the Cache API:
|
| void OnCacheMatch(int thread_id,
|
| int request_id,
|
| int cache_id,
|
| const ServiceWorkerFetchRequest& request,
|
| - const ServiceWorkerCacheQueryParams& match_params);
|
| + const CacheStorageCacheQueryParams& match_params);
|
| void OnCacheMatchAll(int thread_id,
|
| int request_id,
|
| int cache_id,
|
| const ServiceWorkerFetchRequest& request,
|
| - const ServiceWorkerCacheQueryParams& match_params);
|
| + const CacheStorageCacheQueryParams& match_params);
|
| void OnCacheKeys(int thread_id,
|
| int request_id,
|
| int cache_id,
|
| const ServiceWorkerFetchRequest& request,
|
| - const ServiceWorkerCacheQueryParams& match_params);
|
| + const CacheStorageCacheQueryParams& match_params);
|
| void OnCacheBatch(int thread_id,
|
| int request_id,
|
| int cache_id,
|
| - const std::vector<ServiceWorkerBatchOperation>& operations);
|
| + const std::vector<CacheStorageBatchOperation>& operations);
|
| void OnCacheClosed(int cache_id);
|
| void OnBlobDataHandled(const std::string& uuid);
|
|
|
| private:
|
| typedef int32_t CacheID; // TODO(jkarlin): Bump to 64 bit.
|
| - typedef std::map<CacheID, scoped_refptr<ServiceWorkerCache>> IDToCacheMap;
|
| + typedef std::map<CacheID, scoped_refptr<CacheStorageCache>> IDToCacheMap;
|
| typedef std::map<std::string, std::list<storage::BlobDataHandle>>
|
| UUIDToBlobDataHandleList;
|
|
|
| void Send(IPC::Message* message);
|
|
|
| // CacheStorageManager callbacks
|
| - void OnCacheStorageGetCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| - void OnCacheStorageHasCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - bool has_cache,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| + void OnCacheStorageGetCallback(int thread_id,
|
| + int request_id,
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorage::CacheStorageError error);
|
| + void OnCacheStorageHasCallback(int thread_id,
|
| + int request_id,
|
| + bool has_cache,
|
| + CacheStorage::CacheStorageError error);
|
| void OnCacheStorageCreateCallback(
|
| int thread_id,
|
| int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| - void OnCacheStorageOpenCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| - void OnCacheStorageDeleteCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - bool deleted,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| - void OnCacheStorageKeysCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - const std::vector<std::string>& strings,
|
| - ServiceWorkerCacheStorage::CacheStorageError error);
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorage::CacheStorageError error);
|
| + void OnCacheStorageOpenCallback(int thread_id,
|
| + int request_id,
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorage::CacheStorageError error);
|
| + void OnCacheStorageDeleteCallback(int thread_id,
|
| + int request_id,
|
| + bool deleted,
|
| + CacheStorage::CacheStorageError error);
|
| + void OnCacheStorageKeysCallback(int thread_id,
|
| + int request_id,
|
| + const std::vector<std::string>& strings,
|
| + CacheStorage::CacheStorageError error);
|
| void OnCacheStorageMatchCallback(
|
| int thread_id,
|
| int request_id,
|
| - ServiceWorkerCache::ErrorType error,
|
| + CacheStorageCache::ErrorType error,
|
| scoped_ptr<ServiceWorkerResponse> response,
|
| scoped_ptr<storage::BlobDataHandle> blob_data_handle);
|
|
|
| @@ -133,30 +128,30 @@ class ServiceWorkerCacheListener {
|
| void OnCacheMatchCallback(
|
| int thread_id,
|
| int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCache::ErrorType error,
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorageCache::ErrorType error,
|
| scoped_ptr<ServiceWorkerResponse> response,
|
| scoped_ptr<storage::BlobDataHandle> blob_data_handle);
|
| void OnCacheKeysCallback(int thread_id,
|
| int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCache::ErrorType error,
|
| - scoped_ptr<ServiceWorkerCache::Requests> requests);
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorageCache::ErrorType error,
|
| + scoped_ptr<CacheStorageCache::Requests> requests);
|
| void OnCacheDeleteCallback(int thread_id,
|
| int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCache::ErrorType error);
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorageCache::ErrorType error);
|
| void OnCachePutCallback(int thread_id,
|
| int request_id,
|
| - const scoped_refptr<ServiceWorkerCache>& cache,
|
| - ServiceWorkerCache::ErrorType error,
|
| + const scoped_refptr<CacheStorageCache>& cache,
|
| + CacheStorageCache::ErrorType error,
|
| scoped_ptr<ServiceWorkerResponse> response,
|
| scoped_ptr<storage::BlobDataHandle> blob_data_handle);
|
|
|
| // Hangs onto a scoped_refptr for the cache if it isn't already doing so.
|
| // Returns a unique cache_id. Call DropCacheReference when the client is done
|
| // with this cache.
|
| - CacheID StoreCacheReference(const scoped_refptr<ServiceWorkerCache>& cache);
|
| + CacheID StoreCacheReference(const scoped_refptr<CacheStorageCache>& cache);
|
| void DropCacheReference(CacheID cache_id);
|
|
|
| // Stores blob handles while waiting for acknowledgement of receipt from the
|
| @@ -175,11 +170,11 @@ class ServiceWorkerCacheListener {
|
|
|
| UUIDToBlobDataHandleList blob_handle_store_;
|
|
|
| - base::WeakPtrFactory<ServiceWorkerCacheListener> weak_factory_;
|
| + base::WeakPtrFactory<CacheStorageListener> weak_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheListener);
|
| + DISALLOW_COPY_AND_ASSIGN(CacheStorageListener);
|
| };
|
|
|
| } // namespace content
|
|
|
| -#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
|
| +#endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_LISTENER_H_
|
|
|