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_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_
11 #include "base/debug/trace_event.h"
12 #include "content/public/browser/browser_message_filter.h"
16 // This class sends and receives trace messages on the browser process.
17 // See also: tracing_controller.h
18 // See also: child_trace_message_filter.h
19 class TraceMessageFilter : public BrowserMessageFilter {
23 // BrowserMessageFilter implementation.
24 void OnChannelClosing() override;
25 bool OnMessageReceived(const IPC::Message& message) override;
27 void SendBeginTracing(const base::debug::CategoryFilter& category_filter_str,
28 const base::debug::TraceOptions& options);
29 void SendEndTracing();
30 void SendEnableMonitoring(const base::debug::CategoryFilter& category_filter,
31 const base::debug::TraceOptions& options);
32 void SendDisableMonitoring();
33 void SendCaptureMonitoringSnapshot();
34 void SendGetTraceBufferPercentFull();
35 void SendSetWatchEvent(const std::string& category_name,
36 const std::string& event_name);
37 void SendCancelWatchEvent();
40 ~TraceMessageFilter() override;
44 void OnChildSupportsTracing();
45 void OnEndTracingAck(const std::vector<std::string>& known_categories);
46 void OnCaptureMonitoringSnapshotAcked();
47 void OnWatchEventMatched();
48 void OnTraceBufferPercentFullReply(float percent_full);
49 void OnTraceDataCollected(const std::string& data);
50 void OnMonitoringTraceDataCollected(const std::string& data);
52 // ChildTraceMessageFilter exists:
55 // Awaiting ack for previously sent SendEndTracing
56 bool is_awaiting_end_ack_;
57 // Awaiting ack for previously sent SendCaptureMonitoringSnapshot
58 bool is_awaiting_capture_monitoring_snapshot_ack_;
59 // Awaiting ack for previously sent SendGetTraceBufferPercentFull
60 bool is_awaiting_buffer_percent_full_ack_;
62 DISALLOW_COPY_AND_ASSIGN(TraceMessageFilter);
65 } // namespace content
67 #endif // CONTENT_BROWSER_TRACING_TRACE_MESSAGE_FILTER_H_