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

Side by Side Diff: components/safe_browsing_db/v4_store.h

Issue 2425703004: Destroy store on task runner. That's where all store operations happen. (Closed)
Patch Set: shess@feedback. WaitForTasksOnTaskRunner at the end of the test that calls ApplyUpdate and expects … Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void ApplyUpdate(std::unique_ptr<ListUpdateResponse> response, 169 void ApplyUpdate(std::unique_ptr<ListUpdateResponse> response,
170 const scoped_refptr<base::SingleThreadTaskRunner>&, 170 const scoped_refptr<base::SingleThreadTaskRunner>&,
171 UpdatedStoreReadyCallback); 171 UpdatedStoreReadyCallback);
172 172
173 // If a hash prefix in this store matches |full_hash|, returns that hash 173 // If a hash prefix in this store matches |full_hash|, returns that hash
174 // prefix; otherwise returns an empty hash prefix. 174 // prefix; otherwise returns an empty hash prefix.
175 virtual HashPrefix GetMatchingHashPrefix(const FullHash& full_hash); 175 virtual HashPrefix GetMatchingHashPrefix(const FullHash& full_hash);
176 176
177 std::string DebugString() const; 177 std::string DebugString() const;
178 178
179 // Schedules the destruction of the V4Store object pointed to by |v4_store|,
180 // on the task runner.
181 static void Destroy(std::unique_ptr<V4Store> v4_store);
182
179 // Reads the store file from disk and populates the in-memory representation 183 // Reads the store file from disk and populates the in-memory representation
180 // of the hash prefixes. 184 // of the hash prefixes.
181 void Initialize(); 185 void Initialize();
182 186
183 // Reset internal state. 187 // Reset internal state.
184 void Reset(); 188 void Reset();
185 189
186 // Scheduled after reading the store file from disk on startup. When run, it 190 // Scheduled after reading the store file from disk on startup. When run, it
187 // ensures that the checksum of the hash prefixes in lexicographical sorted 191 // ensures that the checksum of the hash prefixes in lexicographical sorted
188 // order matches the expected value in |expected_checksum_|. Returns true if 192 // order matches the expected value in |expected_checksum_|. Returns true if
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 const base::FilePath store_path_; 386 const base::FilePath store_path_;
383 HashPrefixMap hash_prefix_map_; 387 HashPrefixMap hash_prefix_map_;
384 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 388 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
385 }; 389 };
386 390
387 std::ostream& operator<<(std::ostream& os, const V4Store& store); 391 std::ostream& operator<<(std::ostream& os, const V4Store& store);
388 392
389 } // namespace safe_browsing 393 } // namespace safe_browsing
390 394
391 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 395 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_database_unittest.cc ('k') | components/safe_browsing_db/v4_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698