Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: components/visitedlink/renderer/visitedlink_slave.h

Issue 2048503002: Convert visitedlink to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@message-mojom-magic
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shared_memory.h" 10 #include "components/visitedlink/common/visitedlink.mojom.h"
11 #include "components/visitedlink/common/visitedlink_common.h" 11 #include "components/visitedlink/common/visitedlink_common.h"
12 #include "content/public/renderer/render_thread_observer.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/system/buffer.h"
13 14
14 namespace visitedlink { 15 namespace visitedlink {
15 16
16 // Reads the link coloring database provided by the master. There can be any 17 // Reads the link coloring database provided by the master. There can be any
17 // number of slaves reading the same database. 18 // number of slaves reading the same database.
18 class VisitedLinkSlave : public VisitedLinkCommon, 19 class VisitedLinkSlave : public VisitedLinkCommon,
19 public content::RenderThreadObserver { 20 public mojom::VisitedLinkNotificationSink {
20 public: 21 public:
21 VisitedLinkSlave(); 22 VisitedLinkSlave();
22 ~VisitedLinkSlave() override; 23 ~VisitedLinkSlave() override;
23 24
24 // RenderThreadObserver implementation. 25 void Bind(mojom::VisitedLinkNotificationSinkRequest request);
25 bool OnControlMessageReceived(const IPC::Message& message) override;
26 26
27 // Message handlers. 27 // mojom::VisitedLinkNotificationSink overrides.
28 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); 28 void UpdateVisitedLinks(mojo::ScopedSharedBufferHandle table) override;
29 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); 29 void AddVisitedLinks(
30 void OnResetVisitedLinks(bool invalidate_hashes); 30 const std::vector<VisitedLinkSlave::Fingerprint>& fingerprints) override;
31 void ResetVisitedLinks(bool invalidate_hashes) override;
31 32
32 private: 33 private:
33 void FreeTable(); 34 void FreeTable();
34 35
35 // shared memory consists of a SharedHeader followed by the table 36 mojo::ScopedSharedBufferMapping table_mapping_;
36 base::SharedMemory* shared_memory_; 37
38 mojo::Binding<mojom::VisitedLinkNotificationSink> binding_;
37 39
38 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); 40 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave);
39 }; 41 };
40 42
41 } // namespace visitedlink 43 } // namespace visitedlink
42 44
43 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ 45 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698