| Index: services/url_response_disk_cache/url_response_disk_cache_impl.h
|
| diff --git a/services/url_response_disk_cache/url_response_disk_cache_impl.h b/services/url_response_disk_cache/url_response_disk_cache_impl.h
|
| index fc70766623474140535f5cee0e664a16ab188107..96f326ad6c13404c857cbc4c4967d4386d307c24 100644
|
| --- a/services/url_response_disk_cache/url_response_disk_cache_impl.h
|
| +++ b/services/url_response_disk_cache/url_response_disk_cache_impl.h
|
| @@ -7,9 +7,11 @@
|
|
|
| #include "base/files/file_path.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/task_runner.h"
|
| #include "mojo/public/cpp/bindings/strong_binding.h"
|
| #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_disk_cache.mojom.h"
|
| +#include "services/url_response_disk_cache/url_response_disk_cache_db.h"
|
|
|
| namespace mojo {
|
|
|
| @@ -18,44 +20,50 @@ class URLResponseDiskCacheImpl : public URLResponseDiskCache {
|
| using FilePathPairCallback =
|
| base::Callback<void(const base::FilePath&, const base::FilePath&)>;
|
|
|
| - // Cleares the cached content. The actual deletion will be performed using the
|
| - // given task runner, but cache appears as cleared immediately after the
|
| - // function returns.
|
| - static void ClearCache(base::TaskRunner* task_runner);
|
| + // Create the disk cache database. If |force_clean| is true, or the database
|
| + // is outdated, it will clear the cached content. The actual deletion will be
|
| + // performed using the given task runner, but cache appears as cleared
|
| + // immediately after the function returns.
|
| + static scoped_refptr<URLResponseDiskCacheDB> CreateDB(
|
| + scoped_refptr<base::TaskRunner> task_runner,
|
| + bool force_clean);
|
|
|
| - URLResponseDiskCacheImpl(base::TaskRunner* task_runner,
|
| + URLResponseDiskCacheImpl(scoped_refptr<base::TaskRunner> task_runner,
|
| + scoped_refptr<URLResponseDiskCacheDB> db,
|
| const std::string& remote_application_url,
|
| InterfaceRequest<URLResponseDiskCache> request);
|
| ~URLResponseDiskCacheImpl() override;
|
|
|
| private:
|
| // URLResponseDiskCache
|
| - void GetFile(mojo::URLResponsePtr response,
|
| + void GetFile(URLResponsePtr response,
|
| const GetFileCallback& callback) override;
|
| + void GetCachedResponse(const String& url,
|
| + const GetCachedResponseCallback& callback) override;
|
| void GetExtractedContent(
|
| - mojo::URLResponsePtr response,
|
| + URLResponsePtr response,
|
| const GetExtractedContentCallback& callback) override;
|
| + void UpdateCache(URLResponsePtr response) override;
|
|
|
| // As |GetFile|, but uses FilePath instead of mojo arrays.
|
| - void GetFileInternal(mojo::URLResponsePtr response,
|
| + void GetFileInternal(URLResponsePtr response,
|
| const FilePathPairCallback& callback);
|
|
|
| // Internal implementation of |GetExtractedContent|. The parameters are:
|
| // |callback|: The callback to return values to the caller. It uses FilePath
|
| // instead of mojo arrays.
|
| - // |base_dir|: The base directory for caching data associated to the response.
|
| - // |extracted_dir|: The directory where the file content must be extracted. It
|
| - // will be returned to the consumer.
|
| // |content|: The content of the body of the response.
|
| - // |cache_dir|: The directory the user can user to cache its own content.
|
| - void GetExtractedContentInternal(const FilePathPairCallback& callback,
|
| - const base::FilePath& base_dir,
|
| - const base::FilePath& extracted_dir,
|
| - const base::FilePath& content,
|
| - const base::FilePath& cache_dir);
|
| + // |cache_directory|: The directory the user can user to cache its own
|
| + // content.
|
| + void GetExtractedContentInternal(
|
| + const FilePathPairCallback& callback,
|
| + const base::FilePath& content_path,
|
| + const base::FilePath& consumer_cache_directory);
|
|
|
| - base::TaskRunner* task_runner_;
|
| - base::FilePath base_directory_;
|
| + scoped_refptr<base::TaskRunner> task_runner_;
|
| + std::string request_origin_;
|
| + base::FilePath cache_directory_;
|
| + scoped_refptr<URLResponseDiskCacheDB> db_;
|
| StrongBinding<URLResponseDiskCache> binding_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheImpl);
|
|
|