1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_
6 #define CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_
11 #include "base/basictypes.h"
12 #include "ipc/ipc_channel_proxy.h"
15 class HistogramDeltaSerialization;
16 class MessageLoopProxy;
21 class ChildHistogramMessageFilter : public IPC::ChannelProxy::MessageFilter {
23 ChildHistogramMessageFilter();
25 // IPC::ChannelProxy::MessageFilter implementation.
26 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
27 virtual void OnFilterRemoved() OVERRIDE;
28 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
30 void SendHistograms(int sequence_number);
33 typedef std::vector<std::string> HistogramPickledList;
35 virtual ~ChildHistogramMessageFilter();
38 virtual void OnGetChildHistogramData(int sequence_number);
40 // Extract snapshot data and then send it off the the Browser process.
41 // Send only a delta to what we have already sent.
42 void UploadAllHistograms(int sequence_number);
44 IPC::Channel* channel_;
46 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
48 // Prepares histogram deltas for transmission.
49 scoped_ptr<base::HistogramDeltaSerialization> histogram_delta_serialization_;
51 DISALLOW_COPY_AND_ASSIGN(ChildHistogramMessageFilter);
54 } // namespace content
56 #endif // CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_