summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/visitedlink_slave.h
blob: d4371267d3c03d58d60777aa2335656cdb1a3e04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2006-2008 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 CHROME_RENDERER_VISITEDLINK_SLAVE_H_
#define CHROME_RENDERER_VISITEDLINK_SLAVE_H_
#pragma once

#include "base/shared_memory.h"
#include "chrome/common/visitedlink_common.h"
#include "content/renderer/render_process_observer.h"

// 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 RenderProcessObserver {
 public:
  VisitedLinkSlave();
  virtual ~VisitedLinkSlave();

  // RenderProcessObserver implementation.
  virtual bool OnControlMessageReceived(const IPC::Message& message);

  // Message handlers.
  void OnUpdateVisitedLinks(base::SharedMemoryHandle table);
  void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints);
  void OnResetVisitedLinks();
 private:
  void FreeTable();

  // shared memory consists of a SharedHeader followed by the table
  base::SharedMemory* shared_memory_;

  DISALLOW_COPY_AND_ASSIGN(VisitedLinkSlave);
};

#endif  // CHROME_RENDERER_VISITEDLINK_SLAVE_H_