| 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_COMMON_VISITEDLINK_COMMON_H__ | 5 #ifndef CHROME_COMMON_VISITEDLINK_COMMON_H__ |
| 6 #define CHROME_COMMON_VISITEDLINK_COMMON_H__ | 6 #define CHROME_COMMON_VISITEDLINK_COMMON_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 | 14 |
| 14 // number of bytes in the salt | 15 // number of bytes in the salt |
| 15 #define LINK_SALT_LENGTH 8 | 16 #define LINK_SALT_LENGTH 8 |
| 16 | 17 |
| 17 // A multiprocess-safe database of the visited links for the browser. There | 18 // A multiprocess-safe database of the visited links for the browser. There |
| 18 // should be exactly one process that has write access (implemented by | 19 // should be exactly one process that has write access (implemented by |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 // URL. This URL is hashed and we see if it is in the URL hashtable. If it is, | 38 // URL. This URL is hashed and we see if it is in the URL hashtable. If it is, |
| 38 // we consider it visited. Otherwise, it is unvisited. Note that it is possible | 39 // we consider it visited. Otherwise, it is unvisited. Note that it is possible |
| 39 // to get collisions, which is the penalty for not storing all URL strings in | 40 // to get collisions, which is the penalty for not storing all URL strings in |
| 40 // memory (which could get to be more than we want to have in memory). We use | 41 // memory (which could get to be more than we want to have in memory). We use |
| 41 // a salt value for the links on one computer so that an attacker can not | 42 // a salt value for the links on one computer so that an attacker can not |
| 42 // manually create a link that causes a collision. | 43 // manually create a link that causes a collision. |
| 43 class VisitedLinkCommon { | 44 class VisitedLinkCommon { |
| 44 public: | 45 public: |
| 45 // A number that identifies the URL. | 46 // A number that identifies the URL. |
| 46 typedef uint64 Fingerprint; | 47 typedef uint64 Fingerprint; |
| 48 typedef std::vector<Fingerprint> Fingerprints; |
| 47 | 49 |
| 48 // A hash value of a fingerprint | 50 // A hash value of a fingerprint |
| 49 typedef int32 Hash; | 51 typedef int32 Hash; |
| 50 | 52 |
| 51 // A fingerprint or hash value that does not exist | 53 // A fingerprint or hash value that does not exist |
| 52 static const Fingerprint null_fingerprint_; | 54 static const Fingerprint null_fingerprint_; |
| 53 static const Hash null_hash_; | 55 static const Hash null_hash_; |
| 54 | 56 |
| 55 VisitedLinkCommon(); | 57 VisitedLinkCommon(); |
| 56 virtual ~VisitedLinkCommon(); | 58 virtual ~VisitedLinkCommon(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 int32 table_length_; | 128 int32 table_length_; |
| 127 | 129 |
| 128 // salt used for each URL when computing the fingerprint | 130 // salt used for each URL when computing the fingerprint |
| 129 uint8 salt_[LINK_SALT_LENGTH]; | 131 uint8 salt_[LINK_SALT_LENGTH]; |
| 130 | 132 |
| 131 private: | 133 private: |
| 132 DISALLOW_EVIL_CONSTRUCTORS(VisitedLinkCommon); | 134 DISALLOW_EVIL_CONSTRUCTORS(VisitedLinkCommon); |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 #endif // WIN_COMMON_VISITEDLINK_COMMON_H__ | 137 #endif // WIN_COMMON_VISITEDLINK_COMMON_H__ |
| OLD | NEW |