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

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

Issue 2103693002: SafeBrowsing PVer4: Send mutable response to the database and the stores (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_ReadFromDisk
Patch Set: Minor: Add the explicit keyword for UpdateListIdentifier constructor Created 4 years, 5 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // performed on the correct thread. |store_path| specifies the location on 95 // performed on the correct thread. |store_path| specifies the location on
96 // disk for this file. The constructor doesn't read the store file from disk. 96 // disk for this file. The constructor doesn't read the store file from disk.
97 V4Store(const scoped_refptr<base::SequencedTaskRunner>& task_runner, 97 V4Store(const scoped_refptr<base::SequencedTaskRunner>& task_runner,
98 const base::FilePath& store_path); 98 const base::FilePath& store_path);
99 virtual ~V4Store(); 99 virtual ~V4Store();
100 100
101 const std::string& state() const { return state_; } 101 const std::string& state() const { return state_; }
102 102
103 const base::FilePath& store_path() const { return store_path_; } 103 const base::FilePath& store_path() const { return store_path_; }
104 104
105 void ApplyUpdate(const ListUpdateResponse&, 105 void ApplyUpdate(std::unique_ptr<ListUpdateResponse> response,
106 const scoped_refptr<base::SingleThreadTaskRunner>&, 106 const scoped_refptr<base::SingleThreadTaskRunner>&,
107 UpdatedStoreReadyCallback); 107 UpdatedStoreReadyCallback);
108 108
109 std::string DebugString() const; 109 std::string DebugString() const;
110 110
111 // Reads the store file from disk and populates the in-memory representation 111 // Reads the store file from disk and populates the in-memory representation
112 // of the hash prefixes. 112 // of the hash prefixes.
113 void Initialize(); 113 void Initialize();
114 114
115 // Reset internal state and delete the backing file. 115 // Reset internal state and delete the backing file.
(...skipping 10 matching lines...) Expand all
126 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWriteNoResponseType); 126 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWriteNoResponseType);
127 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWritePartialResponseType); 127 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWritePartialResponseType);
128 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWriteFullResponseType); 128 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestWriteFullResponseType);
129 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestReadFromFileWithUnknownProto); 129 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestReadFromFileWithUnknownProto);
130 130
131 // Reads the state of the store from the file on disk and returns the reason 131 // Reads the state of the store from the file on disk and returns the reason
132 // for the failure or reports success. 132 // for the failure or reports success.
133 StoreReadResult ReadFromDisk(); 133 StoreReadResult ReadFromDisk();
134 134
135 // Writes the FULL_UPDATE |response| to disk as a V4StoreFileFormat proto. 135 // Writes the FULL_UPDATE |response| to disk as a V4StoreFileFormat proto.
136 StoreWriteResult WriteToDisk(const ListUpdateResponse& response) const; 136 StoreWriteResult WriteToDisk(
137 std::unique_ptr<ListUpdateResponse> response) const;
137 138
138 // The state of the store as returned by the PVer4 server in the last applied 139 // The state of the store as returned by the PVer4 server in the last applied
139 // update response. 140 // update response.
140 std::string state_; 141 std::string state_;
141 const base::FilePath store_path_; 142 const base::FilePath store_path_;
142 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 143 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
143 }; 144 };
144 145
145 std::ostream& operator<<(std::ostream& os, const V4Store& store); 146 std::ostream& operator<<(std::ostream& os, const V4Store& store);
146 147
147 } // namespace safe_browsing 148 } // namespace safe_browsing
148 149
149 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 150 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_protocol_manager_util.h ('k') | components/safe_browsing_db/v4_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698