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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_store_file.h

Issue 3461019: FBTF: Move virtual methods to implementation files. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Win+chromeos+mac fixes Created 10 years, 3 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 public: 117 public:
118 SafeBrowsingStoreFile(); 118 SafeBrowsingStoreFile();
119 virtual ~SafeBrowsingStoreFile(); 119 virtual ~SafeBrowsingStoreFile();
120 120
121 virtual void Init(const FilePath& filename, 121 virtual void Init(const FilePath& filename,
122 Callback0::Type* corruption_callback); 122 Callback0::Type* corruption_callback);
123 123
124 // Delete any on-disk files, including the permanent storage. 124 // Delete any on-disk files, including the permanent storage.
125 virtual bool Delete(); 125 virtual bool Delete();
126 126
127 virtual bool BeginChunk() { 127 virtual bool BeginChunk();
128 return ClearChunkBuffers(); 128 virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix);
129 }
130 virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) {
131 add_prefixes_.push_back(SBAddPrefix(chunk_id, prefix));
132 return true;
133 }
134 virtual bool WriteAddHash(int32 chunk_id, 129 virtual bool WriteAddHash(int32 chunk_id,
135 base::Time receive_time, SBFullHash full_hash) { 130 base::Time receive_time, SBFullHash full_hash);
136 add_hashes_.push_back(SBAddFullHash(chunk_id, receive_time, full_hash));
137 return true;
138 }
139 virtual bool WriteSubPrefix(int32 chunk_id, 131 virtual bool WriteSubPrefix(int32 chunk_id,
140 int32 add_chunk_id, SBPrefix prefix) { 132 int32 add_chunk_id, SBPrefix prefix);
141 sub_prefixes_.push_back(SBSubPrefix(chunk_id, add_chunk_id, prefix));
142 return true;
143 }
144 virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, 133 virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id,
145 SBFullHash full_hash) { 134 SBFullHash full_hash);
146 sub_hashes_.push_back(SBSubFullHash(chunk_id, add_chunk_id, full_hash));
147 return true;
148 }
149 virtual bool FinishChunk(); 135 virtual bool FinishChunk();
150 136
151 virtual bool BeginUpdate(); 137 virtual bool BeginUpdate();
152 virtual bool DoUpdate(const std::vector<SBAddFullHash>& pending_adds, 138 virtual bool DoUpdate(const std::vector<SBAddFullHash>& pending_adds,
153 std::vector<SBAddPrefix>* add_prefixes_result, 139 std::vector<SBAddPrefix>* add_prefixes_result,
154 std::vector<SBAddFullHash>* add_full_hashes_result); 140 std::vector<SBAddFullHash>* add_full_hashes_result);
155 virtual bool FinishUpdate(const std::vector<SBAddFullHash>& pending_adds, 141 virtual bool FinishUpdate(const std::vector<SBAddFullHash>& pending_adds,
156 std::vector<SBAddPrefix>* add_prefixes_result, 142 std::vector<SBAddPrefix>* add_prefixes_result,
157 std::vector<SBAddFullHash>* add_full_hashes_result); 143 std::vector<SBAddFullHash>* add_full_hashes_result);
158 virtual bool CancelUpdate(); 144 virtual bool CancelUpdate();
159 145
160 virtual void SetAddChunk(int32 chunk_id) { 146 virtual void SetAddChunk(int32 chunk_id);
161 add_chunks_cache_.insert(chunk_id); 147 virtual bool CheckAddChunk(int32 chunk_id);
162 } 148 virtual void GetAddChunks(std::vector<int32>* out);
163 virtual bool CheckAddChunk(int32 chunk_id) { 149 virtual void SetSubChunk(int32 chunk_id);
164 return add_chunks_cache_.count(chunk_id) > 0; 150 virtual bool CheckSubChunk(int32 chunk_id);
165 } 151 virtual void GetSubChunks(std::vector<int32>* out);
166 virtual void GetAddChunks(std::vector<int32>* out) {
167 out->clear();
168 out->insert(out->end(), add_chunks_cache_.begin(), add_chunks_cache_.end());
169 }
170 virtual void SetSubChunk(int32 chunk_id) {
171 sub_chunks_cache_.insert(chunk_id);
172 }
173 virtual bool CheckSubChunk(int32 chunk_id) {
174 return sub_chunks_cache_.count(chunk_id) > 0;
175 }
176 virtual void GetSubChunks(std::vector<int32>* out) {
177 out->clear();
178 out->insert(out->end(), sub_chunks_cache_.begin(), sub_chunks_cache_.end());
179 }
180 152
181 virtual void DeleteAddChunk(int32 chunk_id) { 153 virtual void DeleteAddChunk(int32 chunk_id);
182 add_del_cache_.insert(chunk_id); 154 virtual void DeleteSubChunk(int32 chunk_id);
183 }
184 virtual void DeleteSubChunk(int32 chunk_id) {
185 sub_del_cache_.insert(chunk_id);
186 }
187 155
188 // Returns the name of the temporary file used to buffer data for 156 // Returns the name of the temporary file used to buffer data for
189 // |filename|. Exported for unit tests. 157 // |filename|. Exported for unit tests.
190 static const FilePath TemporaryFileForFilename(const FilePath& filename) { 158 static const FilePath TemporaryFileForFilename(const FilePath& filename) {
191 return FilePath(filename.value() + FILE_PATH_LITERAL("_new")); 159 return FilePath(filename.value() + FILE_PATH_LITERAL("_new"));
192 } 160 }
193 161
194 private: 162 private:
195 // Close all files and clear all buffers. 163 // Close all files and clear all buffers.
196 bool Close(); 164 bool Close();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // slower than plain set<>. 232 // slower than plain set<>.
265 base::hash_set<int32> add_del_cache_; 233 base::hash_set<int32> add_del_cache_;
266 base::hash_set<int32> sub_del_cache_; 234 base::hash_set<int32> sub_del_cache_;
267 235
268 scoped_ptr<Callback0::Type> corruption_callback_; 236 scoped_ptr<Callback0::Type> corruption_callback_;
269 237
270 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStoreFile); 238 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingStoreFile);
271 }; 239 };
272 240
273 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_ 241 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_STORE_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698