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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2062013002: Fetch incremental updates. Store new state in V4Store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit: Use base::SStringPrintf instead of string concat Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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 7be3f72f20a158cf89973db533b9c89dffb5a2a9..d3fdaea7fa23289a519d2b5b4bb053c68464e121 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -8,11 +8,16 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
+#include "base/single_thread_task_runner.h"
+#include "components/safe_browsing_db/v4_protocol_manager_util.h"
namespace safe_browsing {
class V4Store;
+typedef base::Callback<void(std::unique_ptr<V4Store>)>
+ UpdatedStoreReadyCallback;
+
// Factory for creating V4Store. Tests implement this factory to create fake
// stores for testing.
class V4StoreFactory {
@@ -32,20 +37,35 @@ class V4Store {
const base::FilePath& store_path);
virtual ~V4Store();
+ const base::FilePath& store_path() const { return store_path_; }
+
+ const std::string& state() const { return state_; }
+
+ void ApplyUpdate(const ListUpdateResponse&,
+ const scoped_refptr<base::SingleThreadTaskRunner>&,
+ UpdatedStoreReadyCallback);
+
// Reset internal state and delete the backing file.
virtual bool Reset();
- const base::FilePath& store_path() const {
- return store_path_;
- }
+ std::string DebugString() const;
protected:
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
const base::FilePath store_path_;
+ std::string state_;
+
+ private:
+ V4Store(const V4Store& other);
- DISALLOW_COPY_AND_ASSIGN(V4Store);
+ std::string GetHumanReadableState() const;
};
+inline std::ostream& operator<<(std::ostream& os, const V4Store& store) {
+ os << store.DebugString();
Nathan Parker 2016/06/15 21:24:21 Does this need to be inline? The code could do in
vakh (use Gerrit instead) 2016/06/16 01:07:35 Done.
+ return os;
+}
+
} // namespace safe_browsing
#endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698