Chromium Code Reviews| Index: components/safe_browsing_db/v4_store.h |
| diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h |
| index 9775ee715d1e7e9cde346a12e6386a5d376d865c..6a254246d1109bdd1d5a42f074c52525eac350ff 100644 |
| --- a/components/safe_browsing_db/v4_store.h |
| +++ b/components/safe_browsing_db/v4_store.h |
| @@ -15,7 +15,7 @@ namespace safe_browsing { |
| class V4Store; |
| -typedef base::Callback<void(std::unique_ptr<V4Store>)> |
| +typedef base::Callback<void(std::unique_ptr<V4Store> new_store)> |
| UpdatedStoreReadyCallback; |
| // The sorted list of hash prefixes. |
| @@ -158,8 +158,12 @@ class V4Store { |
| // The |task_runner| is used to ensure that the operations in this file are |
| // performed on the correct thread. |store_path| specifies the location on |
| // disk for this file. The constructor doesn't read the store file from disk. |
| + // If the store is being created to apply an update to the old store, then |
| + // |old_file_size| is the size of the existing file on disk for this store; |
| + // 0 otherwise. |
| V4Store(const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| - const base::FilePath& store_path); |
| + const base::FilePath& store_path, |
| + const uint64_t old_file_size = 0); |
|
Nathan Parker
2016/10/24 20:33:55
I'm not clear on why you need the old_file_size. E
vakh (use Gerrit instead)
2016/10/24 21:32:41
Yes, except what do we want to report if the updat
|
| virtual ~V4Store(); |
| const std::string& state() const { return state_; } |
| @@ -167,8 +171,12 @@ class V4Store { |
| const base::FilePath& store_path() const { return store_path_; } |
| void ApplyUpdate(std::unique_ptr<ListUpdateResponse> response, |
| - const scoped_refptr<base::SingleThreadTaskRunner>&, |
| - UpdatedStoreReadyCallback); |
| + const scoped_refptr<base::SingleThreadTaskRunner>& runner, |
| + UpdatedStoreReadyCallback callback); |
| + |
| + // Records (in kilobytes) and returns the size of the file on disk for this |
| + // store using |base_metric| as prefix and the filename as suffix. |
| + uint64_t RecordAndReturnFileSize(const std::string& base_metric); |
| // If a hash prefix in this store matches |full_hash|, returns that hash |
| // prefix; otherwise returns an empty hash prefix. |
| @@ -374,12 +382,15 @@ class V4Store { |
| // Writes the hash_prefix_map_ to disk as a V4StoreFileFormat proto. |
| // |checksum| is used to set the |checksum| field in the final proto. |
| - StoreWriteResult WriteToDisk(const Checksum& checksum) const; |
| + StoreWriteResult WriteToDisk(const Checksum& checksum); |
| // The checksum value as read from the disk, until it is verified. Once |
| // verified, it is cleared. |
| std::string expected_checksum_; |
| + // The size of the file on disk for this store. |
| + uint64_t file_size_; |
| + |
| // The state of the store as returned by the PVer4 server in the last applied |
| // update response. |
| std::string state_; |