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_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
11 #include "content/public/common/process_type.h" | |
12 | 11 |
13 namespace tracked_objects { | 12 namespace tracked_objects { |
14 struct ProcessDataSnapshot; | 13 struct ProcessDataSnapshot; |
15 } | 14 } |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 // This class sends and receives profiler messages in the browser process. | 18 // This class sends and receives profiler messages in the browser process. |
20 class ProfilerMessageFilter : public BrowserMessageFilter { | 19 class ProfilerMessageFilter : public BrowserMessageFilter { |
21 public: | 20 public: |
22 explicit ProfilerMessageFilter(ProcessType process_type); | 21 explicit ProfilerMessageFilter(int process_type); |
23 | 22 |
24 // BrowserMessageFilter implementation. | 23 // BrowserMessageFilter implementation. |
25 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 24 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
26 | 25 |
27 // BrowserMessageFilter implementation. | 26 // BrowserMessageFilter implementation. |
28 virtual bool OnMessageReceived(const IPC::Message& message, | 27 virtual bool OnMessageReceived(const IPC::Message& message, |
29 bool* message_was_ok) OVERRIDE; | 28 bool* message_was_ok) OVERRIDE; |
30 | 29 |
31 protected: | 30 protected: |
32 virtual ~ProfilerMessageFilter(); | 31 virtual ~ProfilerMessageFilter(); |
33 | 32 |
34 private: | 33 private: |
35 // Message handlers. | 34 // Message handlers. |
36 void OnChildProfilerData( | 35 void OnChildProfilerData( |
37 int sequence_number, | 36 int sequence_number, |
38 const tracked_objects::ProcessDataSnapshot& profiler_data); | 37 const tracked_objects::ProcessDataSnapshot& profiler_data); |
39 | 38 |
40 #if defined(USE_TCMALLOC) | 39 #if defined(USE_TCMALLOC) |
41 void OnTcmallocStats(const std::string& output); | 40 void OnTcmallocStats(const std::string& output); |
42 #endif | 41 #endif |
43 | 42 |
44 ProcessType process_type_; | 43 int process_type_; |
45 | 44 |
46 DISALLOW_COPY_AND_ASSIGN(ProfilerMessageFilter); | 45 DISALLOW_COPY_AND_ASSIGN(ProfilerMessageFilter); |
47 }; | 46 }; |
48 | 47 |
49 } // namespace content | 48 } // namespace content |
50 | 49 |
51 #endif // CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 50 #endif // CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
OLD | NEW |