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

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: clang format 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 "base/memory/weak_ptr.h"
11 #include "components/visitedlink/common/visitedlink.mojom.h"
11 #include "components/visitedlink/common/visitedlink_common.h" 12 #include "components/visitedlink/common/visitedlink_common.h"
12 #include "content/public/renderer/render_thread_observer.h" 13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "mojo/public/cpp/system/buffer.h"
13 15
14 namespace visitedlink { 16 namespace visitedlink {
15 17
16 // Reads the link coloring database provided by the master. There can be any 18 // Reads the link coloring database provided by the master. There can be any
17 // number of slaves reading the same database. 19 // number of slaves reading the same database.
18 class VisitedLinkSlave : public VisitedLinkCommon, 20 class VisitedLinkSlave : public VisitedLinkCommon,
19 public content::RenderThreadObserver { 21 public mojom::VisitedLinkNotificationSink {
20 public: 22 public:
21 VisitedLinkSlave(); 23 VisitedLinkSlave();
22 ~VisitedLinkSlave() override; 24 ~VisitedLinkSlave() override;
23 25
24 // RenderThreadObserver implementation. 26 base::Callback<void(mojom::VisitedLinkNotificationSinkRequest)>
25 bool OnControlMessageReceived(const IPC::Message& message) override; 27 GetBindCallback();
26 28
27 // Message handlers. 29 // mojom::VisitedLinkNotificationSink overrides.
28 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); 30 void UpdateVisitedLinks(mojo::ScopedSharedBufferHandle table) override;
29 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); 31 void AddVisitedLinks(
30 void OnResetVisitedLinks(bool invalidate_hashes); 32 const std::vector<VisitedLinkSlave::Fingerprint>& fingerprints) override;
33 void ResetVisitedLinks(bool invalidate_hashes) override;
31 34
32 private: 35 private:
33 void FreeTable(); 36 void FreeTable();
34 37
35 // shared memory consists of a SharedHeader followed by the table 38 void Bind(mojom::VisitedLinkNotificationSinkRequest request);
36 base::SharedMemory* shared_memory_; 39
40 mojo::ScopedSharedBufferMapping table_mapping_;
41
42 mojo::Binding<mojom::VisitedLinkNotificationSink> binding_;
43
44 base::WeakPtrFactory<VisitedLinkSlave> weak_factory_;
37 45
38 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave); 46 DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave);
39 }; 47 };
40 48
41 } // namespace visitedlink 49 } // namespace visitedlink
42 50
43 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_ 51 #endif // COMPONENTS_VISITEDLINK_RENDERER_VISITEDLINK_SLAVE_H_
OLDNEW
« no previous file with comments | « components/visitedlink/common/visitedlink_messages.h ('k') | components/visitedlink/renderer/visitedlink_slave.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698