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 COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_
6 #define COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_
9 #include "base/memory/ref_counted_memory.h"
10 #include "ipc/message_filter.h"
13 class MessageLoopProxy;
18 // This class sends and receives trace messages on child processes.
19 class ChildTraceMessageFilter : public IPC::MessageFilter {
21 explicit ChildTraceMessageFilter(base::MessageLoopProxy* ipc_message_loop);
23 // IPC::MessageFilter implementation.
24 void OnFilterAdded(IPC::Sender* sender) override;
25 void OnFilterRemoved() override;
26 bool OnMessageReceived(const IPC::Message& message) override;
29 ~ChildTraceMessageFilter() override;
33 void OnBeginTracing(const std::string& category_filter_str,
34 base::TimeTicks browser_time,
35 const std::string& options);
37 void OnEnableMonitoring(const std::string& category_filter_str,
38 base::TimeTicks browser_time,
39 const std::string& options);
40 void OnDisableMonitoring();
41 void OnCaptureMonitoringSnapshot();
42 void OnGetTraceBufferPercentFull();
43 void OnSetWatchEvent(const std::string& category_name,
44 const std::string& event_name);
45 void OnCancelWatchEvent();
46 void OnWatchEventMatched();
48 // Callback from trace subsystem.
49 void OnTraceDataCollected(
50 const scoped_refptr<base::RefCountedString>& events_str_ptr,
51 bool has_more_events);
53 void OnMonitoringTraceDataCollected(
54 const scoped_refptr<base::RefCountedString>& events_str_ptr,
55 bool has_more_events);
58 base::MessageLoopProxy* ipc_message_loop_;
60 DISALLOW_COPY_AND_ASSIGN(ChildTraceMessageFilter);
63 } // namespace tracing
65 #endif // COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_