| Index: components/visitedlink/browser/visitedlink_master.h
|
| diff --git a/components/visitedlink/browser/visitedlink_master.h b/components/visitedlink/browser/visitedlink_master.h
|
| index f7f4ca56b164afd651e168c55a87895eab7a55d3..28a70dc7fcef3f95638a6d1dea3b221e3a5a48b8 100644
|
| --- a/components/visitedlink/browser/visitedlink_master.h
|
| +++ b/components/visitedlink/browser/visitedlink_master.h
|
| @@ -18,11 +18,11 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| -#include "base/memory/shared_memory.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "build/build_config.h"
|
| #include "components/visitedlink/common/visitedlink_common.h"
|
| +#include "mojo/public/cpp/system/buffer.h"
|
|
|
| #if defined(OS_WIN)
|
| #include <windows.h>
|
| @@ -58,7 +58,7 @@ class VisitedLinkMaster : public VisitedLinkCommon {
|
|
|
| // Called when link coloring database has been created or replaced. The
|
| // argument is the new table handle.
|
| - virtual void NewTable(base::SharedMemory*) = 0;
|
| + virtual void NewTable(mojo::SharedBufferHandle table) = 0;
|
|
|
| // Called when new link has been added. The argument is the fingerprint
|
| // (hash) of the link.
|
| @@ -75,7 +75,8 @@ class VisitedLinkMaster : public VisitedLinkCommon {
|
|
|
| VisitedLinkMaster(content::BrowserContext* browser_context,
|
| VisitedLinkDelegate* delegate,
|
| - bool persist_to_disk);
|
| + bool persist_to_disk,
|
| + std::unique_ptr<Listener> listener = nullptr);
|
|
|
| // In unit test mode, we allow the caller to optionally specify the database
|
| // filename so that it can be run from a unit test. The directory where this
|
| @@ -105,7 +106,9 @@ class VisitedLinkMaster : public VisitedLinkCommon {
|
| // object won't work.
|
| bool Init();
|
|
|
| - base::SharedMemory* shared_memory() { return shared_memory_; }
|
| + const mojo::SharedBufferHandle& shared_memory() {
|
| + return shared_memory_.get();
|
| + }
|
|
|
| // Adds a URL to the table.
|
| void AddURL(const GURL& url);
|
| @@ -320,11 +323,10 @@ class VisitedLinkMaster : public VisitedLinkCommon {
|
| // Structure is filled with 0s and shared header with salt. The result of
|
| // allocation is saved into |shared_memory| and |hash_table| points to the
|
| // beginning of Fingerprint table in |shared_memory|.
|
| - static bool CreateApartURLTable(
|
| - int32_t num_entries,
|
| - const uint8_t salt[LINK_SALT_LENGTH],
|
| - std::unique_ptr<base::SharedMemory>* shared_memory,
|
| - VisitedLinkCommon::Fingerprint** hash_table);
|
| + static bool CreateApartURLTable(int32_t num_entries,
|
| + const uint8_t salt[LINK_SALT_LENGTH],
|
| + mojo::ScopedSharedBufferHandle* shared_memory,
|
| + mojo::ScopedSharedBufferMapping* hash_table);
|
|
|
| // A wrapper for CreateURLTable, this will allocate a new table, initialized
|
| // to empty. The caller is responsible for saving the shared memory pointer
|
| @@ -435,7 +437,10 @@ class VisitedLinkMaster : public VisitedLinkCommon {
|
| bool persist_to_disk_;
|
|
|
| // Shared memory consists of a SharedHeader followed by the table.
|
| - base::SharedMemory *shared_memory_;
|
| + mojo::ScopedSharedBufferHandle shared_memory_;
|
| +
|
| + // A mapping of the table without the SharedHeader.
|
| + mojo::ScopedSharedBufferMapping hash_table_mapping_;
|
|
|
| // When we generate new tables, we increment the serial number of the
|
| // shared memory object.
|
|
|