OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ |
6 #define CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ | 6 #define CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "ipc/message_filter.h" | 13 #include "ipc/message_filter.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class HistogramDeltaSerialization; | 16 class HistogramDeltaSerialization; |
17 class MessageLoopProxy; | 17 class MessageLoopProxy; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class ChildHistogramMessageFilter : public IPC::MessageFilter { | 22 class ChildHistogramMessageFilter : public IPC::MessageFilter { |
23 public: | 23 public: |
24 ChildHistogramMessageFilter(); | 24 ChildHistogramMessageFilter(); |
25 | 25 |
26 // IPC::MessageFilter implementation. | 26 // IPC::MessageFilter implementation. |
27 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; | 27 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; |
28 virtual void OnFilterRemoved() OVERRIDE; | 28 virtual void OnFilterRemoved() OVERRIDE; |
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
30 | 30 |
31 void SendHistograms(int sequence_number); | 31 void SendHistograms(int sequence_number); |
32 | 32 |
33 private: | 33 private: |
34 typedef std::vector<std::string> HistogramPickledList; | 34 typedef std::vector<std::string> HistogramPickledList; |
35 | 35 |
36 virtual ~ChildHistogramMessageFilter(); | 36 virtual ~ChildHistogramMessageFilter(); |
37 | 37 |
38 // Message handlers. | 38 // Message handlers. |
39 virtual void OnGetChildHistogramData(int sequence_number); | 39 virtual void OnGetChildHistogramData(int sequence_number); |
40 | 40 |
41 // Extract snapshot data and then send it off the the Browser process. | 41 // Extract snapshot data and then send it off the the Browser process. |
42 // Send only a delta to what we have already sent. | 42 // Send only a delta to what we have already sent. |
43 void UploadAllHistograms(int sequence_number); | 43 void UploadAllHistograms(int sequence_number); |
44 | 44 |
45 IPC::Channel* channel_; | 45 IPC::Sender* sender_; |
46 | 46 |
47 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 47 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
48 | 48 |
49 // Prepares histogram deltas for transmission. | 49 // Prepares histogram deltas for transmission. |
50 scoped_ptr<base::HistogramDeltaSerialization> histogram_delta_serialization_; | 50 scoped_ptr<base::HistogramDeltaSerialization> histogram_delta_serialization_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(ChildHistogramMessageFilter); | 52 DISALLOW_COPY_AND_ASSIGN(ChildHistogramMessageFilter); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace content | 55 } // namespace content |
56 | 56 |
57 #endif // CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ | 57 #endif // CONTENT_CHILD_HISTOGRAM_MESSAGE_FILTER_H_ |
OLD | NEW |