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