// Copyright 2022 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_SAFE_BROWSING_CORE_BROWSER_DB_HASH_PREFIX_MAP_H_ #define COMPONENTS_SAFE_BROWSING_CORE_BROWSER_DB_HASH_PREFIX_MAP_H_ #include <memory> #include <string> #include <string_view> #include <unordered_map> #include "base/files/memory_mapped_file.h" #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" #include "components/safe_browsing/core/browser/db/v4_store.pb.h" #include "components/safe_browsing/core/common/proto/webui.pb.h" namespace safe_browsing { // Enumerate different events while applying the update fetched fom the server // for histogramming purposes. // DO NOT CHANGE THE ORDERING OF THESE VALUES. enum ApplyUpdateResult { … }; // The sorted list of hash prefixes. HashPrefixes; HashPrefixesView; HashPrefixMapView; // Set a common sense limit on the store file size we try to read. // The maximum store file size, as of today, is about 6MB. constexpr size_t kMaxStoreSizeBytes = …; // Stores the list of sorted hash prefixes, by size. // For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]} // Maps will be stored a separate file for hash prefix lists of each // prefix size. These will be mapped into memory on initialization. class HashPrefixMap { … }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CORE_BROWSER_DB_HASH_PREFIX_MAP_H_