// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ #define COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "components/visitedlink/common/visitedlink.mojom.h" #include "components/visitedlink/common/visitedlink_common.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/system/buffer.h" #include "services/service_manager/public/cpp/bind_source_info.h" namespace visitedlink { // Reads the link coloring database provided by the master. There can be any // number of slaves reading the same database. class VisitedLinkSlave : public VisitedLinkCommon, public mojom::VisitedLinkNotificationSink { public: VisitedLinkSlave(); ~VisitedLinkSlave() override; base::Callback GetBindCallback(); // mojom::VisitedLinkNotificationSink overrides. void UpdateVisitedLinks(mojo::ScopedSharedBufferHandle table) override; void AddVisitedLinks( const std::vector& fingerprints) override; void ResetVisitedLinks(bool invalidate_hashes) override; private: void FreeTable(); void Bind(const service_manager::BindSourceInfo& source_info, mojom::VisitedLinkNotificationSinkRequest request); mojo::ScopedSharedBufferMapping table_mapping_; mojo::Binding binding_; base::WeakPtrFactory weak_factory_; DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); }; } // namespace visitedlink #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_