| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VISITEDLINK_MASTER_H__ | 5 #ifndef CHROME_BROWSER_VISITEDLINK_MASTER_H__ |
| 6 #define CHROME_BROWSER_VISITEDLINK_MASTER_H__ | 6 #define CHROME_BROWSER_VISITEDLINK_MASTER_H__ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // wrap around at 0 and this function will handle it. | 213 // wrap around at 0 and this function will handle it. |
| 214 void WriteHashRangeToFile(Hash first_hash, Hash last_hash); | 214 void WriteHashRangeToFile(Hash first_hash, Hash last_hash); |
| 215 | 215 |
| 216 // Synchronous read from the file. Assumes there are no pending asynchronous | 216 // Synchronous read from the file. Assumes there are no pending asynchronous |
| 217 // I/O functions. Returns true if the entire buffer was successfully filled. | 217 // I/O functions. Returns true if the entire buffer was successfully filled. |
| 218 bool ReadFromFile(FILE* hfile, off_t offset, void* data, size_t data_size); | 218 bool ReadFromFile(FILE* hfile, off_t offset, void* data, size_t data_size); |
| 219 | 219 |
| 220 // General table handling | 220 // General table handling |
| 221 // ---------------------- | 221 // ---------------------- |
| 222 | 222 |
| 223 // Called to add a fingerprint to the table. Returns the index of the | 223 // Called to add a fingerprint to the table. If |send_notifications| is true |
| 224 // inserted fingerprint or null_hash_ if there was a duplicate and this item | 224 // and the item is added successfully, Listener::Add will be invoked. |
| 225 // was skippped. | 225 // Returns the index of the inserted fingerprint or null_hash_ if there was a |
| 226 Hash AddFingerprint(Fingerprint fingerprint); | 226 // duplicate and this item was skippped. |
| 227 Hash AddFingerprint(Fingerprint fingerprint, bool send_notifications); |
| 227 | 228 |
| 228 // Deletes all fingerprints from the given vector from the current hash table | 229 // Deletes all fingerprints from the given vector from the current hash table |
| 229 // and syncs it to disk if there are changes. This does not update the | 230 // and syncs it to disk if there are changes. This does not update the |
| 230 // deleted_since_rebuild_ list, the caller must update this itself if there | 231 // deleted_since_rebuild_ list, the caller must update this itself if there |
| 231 // is an update pending. | 232 // is an update pending. |
| 232 void DeleteFingerprintsFromCurrentTable( | 233 void DeleteFingerprintsFromCurrentTable( |
| 233 const std::set<Fingerprint>& fingerprints); | 234 const std::set<Fingerprint>& fingerprints); |
| 234 | 235 |
| 235 // Removes the indicated fingerprint from the table. If the update_file flag | 236 // Removes the indicated fingerprint from the table. If the update_file flag |
| 236 // is set, the changes will also be written to disk. Returns true if the | 237 // is set, the changes will also be written to disk. Returns true if the |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 int32 used_count = 0; | 400 int32 used_count = 0; |
| 400 for (int32 i = 0; i < table_length_; i++) { | 401 for (int32 i = 0; i < table_length_; i++) { |
| 401 if (hash_table_[i]) | 402 if (hash_table_[i]) |
| 402 used_count++; | 403 used_count++; |
| 403 } | 404 } |
| 404 DCHECK_EQ(used_count, used_items_); | 405 DCHECK_EQ(used_count, used_items_); |
| 405 } | 406 } |
| 406 #endif | 407 #endif |
| 407 | 408 |
| 408 #endif // CHROME_BROWSER_VISITEDLINK_MASTER_H__ | 409 #endif // CHROME_BROWSER_VISITEDLINK_MASTER_H__ |
| OLD | NEW |