Chromium Code Reviews| 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..fd3f8c23320ddd6c71f8e86c47e99e5f8ed96a85 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,49 @@ class URLResponseDiskCacheImpl : public URLResponseDiskCache { |
| using FilePathPairCallback = |
|
ppi
2015/09/15 15:21:23
nit: wdyt about calling this by meaning, ie. Respo
qsr
2015/09/16 11:46:38
Done.
|
| 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 |
|
ppi
2015/09/15 15:21:23
nit: Creates
qsr
2015/09/16 11:46:39
Done.
|
| + // 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, |
| - const GetFileCallback& callback) override; |
| - void GetExtractedContent( |
| - mojo::URLResponsePtr response, |
| - const GetExtractedContentCallback& callback) override; |
| + void Get(const String& url, const GetCallback& callback) override; |
| + void Update(URLResponsePtr response) override; |
| + void UpdateAndGet(URLResponsePtr response, |
| + const UpdateAndGetCallback& callback) override; |
| + void UpdateAndGetExtracted( |
| + URLResponsePtr response, |
| + const UpdateAndGetExtractedCallback& callback) override; |
| - // As |GetFile|, but uses FilePath instead of mojo arrays. |
| - void GetFileInternal(mojo::URLResponsePtr response, |
| - const FilePathPairCallback& callback); |
| + // As |UpdateAndGet|, but uses FilePath instead of mojo arrays. |
|
ppi
2015/09/15 15:21:23
nit: this comment forces the reader to go back all
qsr
2015/09/16 11:46:38
Done.
|
| + void UpdateAndGetInternal(URLResponsePtr response, |
| + const FilePathPairCallback& callback); |
| - // Internal implementation of |GetExtractedContent|. The parameters are: |
| + // Internal implementation of |UpdateAndGetExtracted|. 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 UpdateAndGetExtractedInternal( |
| + 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); |