| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ | 5 #ifndef COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ |
| 6 #define COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ | 6 #define COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "components/visitedlink/common/visitedlink.mojom.h" | 11 #include "components/visitedlink/common/visitedlink.mojom.h" |
| 12 #include "components/visitedlink/common/visitedlink_common.h" | 12 #include "components/visitedlink/common/visitedlink_common.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 #include "mojo/public/cpp/system/buffer.h" | 14 #include "mojo/public/cpp/system/buffer.h" |
| 15 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 15 | 16 |
| 16 namespace visitedlink { | 17 namespace visitedlink { |
| 17 | 18 |
| 18 // Reads the link coloring database provided by the master. There can be any | 19 // Reads the link coloring database provided by the master. There can be any |
| 19 // number of slaves reading the same database. | 20 // number of slaves reading the same database. |
| 20 class VisitedLinkSlave : public VisitedLinkCommon, | 21 class VisitedLinkSlave : public VisitedLinkCommon, |
| 21 public mojom::VisitedLinkNotificationSink { | 22 public mojom::VisitedLinkNotificationSink { |
| 22 public: | 23 public: |
| 23 VisitedLinkSlave(); | 24 VisitedLinkSlave(); |
| 24 ~VisitedLinkSlave() override; | 25 ~VisitedLinkSlave() override; |
| 25 | 26 |
| 26 base::Callback<void(mojom::VisitedLinkNotificationSinkRequest)> | 27 base::Callback<void(const service_manager::BindSourceInfo&, |
| 28 mojom::VisitedLinkNotificationSinkRequest)> |
| 27 GetBindCallback(); | 29 GetBindCallback(); |
| 28 | 30 |
| 29 // mojom::VisitedLinkNotificationSink overrides. | 31 // mojom::VisitedLinkNotificationSink overrides. |
| 30 void UpdateVisitedLinks(mojo::ScopedSharedBufferHandle table) override; | 32 void UpdateVisitedLinks(mojo::ScopedSharedBufferHandle table) override; |
| 31 void AddVisitedLinks( | 33 void AddVisitedLinks( |
| 32 const std::vector<VisitedLinkSlave::Fingerprint>& fingerprints) override; | 34 const std::vector<VisitedLinkSlave::Fingerprint>& fingerprints) override; |
| 33 void ResetVisitedLinks(bool invalidate_hashes) override; | 35 void ResetVisitedLinks(bool invalidate_hashes) override; |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 void FreeTable(); | 38 void FreeTable(); |
| 37 | 39 |
| 38 void Bind(mojom::VisitedLinkNotificationSinkRequest request); | 40 void Bind(const service_manager::BindSourceInfo& source_info, |
| 41 mojom::VisitedLinkNotificationSinkRequest request); |
| 39 | 42 |
| 40 mojo::ScopedSharedBufferMapping table_mapping_; | 43 mojo::ScopedSharedBufferMapping table_mapping_; |
| 41 | 44 |
| 42 mojo::Binding<mojom::VisitedLinkNotificationSink> binding_; | 45 mojo::Binding<mojom::VisitedLinkNotificationSink> binding_; |
| 43 | 46 |
| 44 base::WeakPtrFactory<VisitedLinkSlave> weak_factory_; | 47 base::WeakPtrFactory<VisitedLinkSlave> weak_factory_; |
| 45 | 48 |
| 46 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); | 49 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 } // namespace visitedlink | 52 } // namespace visitedlink |
| 50 | 53 |
| 51 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ | 54 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ |
| OLD | NEW |