// Copyright 2006-2008 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_VISITEDLINK_COMMON_VISITEDLINK_COMMON_H_ #define COMPONENTS_VISITEDLINK_COMMON_VISITEDLINK_COMMON_H_ #include <stddef.h> #include <stdint.h> #include <string_view> #include <vector> #include "base/memory/raw_ptr.h" #include "components/visitedlink/core/visited_link.h" class GURL; namespace net { class SchemefulSite; } namespace url { class Origin; } namespace visitedlink { // number of bytes in the salt #define LINK_SALT_LENGTH … // A multiprocess-safe database of the visited links for the browser. There // should be exactly one process that has write access (implemented by // VisitedLinkWriter), while all other processes should be read-only // (implemented by VisitedLinkReader). These other processes add links by // calling the writer process to add them for it. The writer may also notify the // readers to replace their table when the table is resized. // // IPC is not implemented in these classes. This is done through callback // functions supplied by the creator of these objects to allow more flexibility, // especially for testing. // // This class defines the common base for these others. We implement accessors // for looking things up in the hash table, and for computing hash values and // fingerprints. Both the writer and the reader inherit from this, and add their // own code to set up and change these values as their design requires. The // reader pretty much just sets up the shared memory and saves the pointer. The // writer does a lot of work to manage the table, reading and writing it to and // from disk, and resizing it when it gets too full. // // To ask whether a page is in history, we compute a 64-bit fingerprint of the // URL. This URL is hashed and we see if it is in the URL hashtable. If it is, // we consider it visited. Otherwise, it is unvisited. Note that it is possible // to get collisions, which is the penalty for not storing all URL strings in // memory (which could get to be more than we want to have in memory). We use // a salt value for the links on one computer so that an attacker can not // manually create a link that causes a collision. class VisitedLinkCommon { … }; } // namespace visitedlink #endif // COMPONENTS_VISITEDLINK_COMMON_VISITEDLINK_COMMON_H_