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 // Multiply-included message header, no traditional include guard.
9 #include "base/basictypes.h"
10 #include "base/metrics/histogram.h"
11 #include "base/sync_socket.h"
12 #include "base/trace_event/memory_dump_request_args.h"
13 #include "base/trace_event/trace_event_impl.h"
14 #include "components/tracing/tracing_export.h"
15 #include "ipc/ipc_channel_handle.h"
16 #include "ipc/ipc_message_macros.h"
17 #include "ipc/ipc_message_utils.h"
18 #include "ipc/ipc_platform_file.h"
20 #undef IPC_MESSAGE_EXPORT
21 #define IPC_MESSAGE_EXPORT TRACING_EXPORT
22 #define IPC_MESSAGE_START TracingMsgStart
24 IPC_STRUCT_TRAITS_BEGIN(base::trace_event::TraceLogStatus
)
25 IPC_STRUCT_TRAITS_MEMBER(event_capacity
)
26 IPC_STRUCT_TRAITS_MEMBER(event_count
)
27 IPC_STRUCT_TRAITS_END()
29 IPC_STRUCT_TRAITS_BEGIN(base::trace_event::MemoryDumpRequestArgs
)
30 IPC_STRUCT_TRAITS_MEMBER(dump_guid
)
31 IPC_STRUCT_TRAITS_MEMBER(dump_type
)
32 IPC_STRUCT_TRAITS_MEMBER(level_of_detail
)
33 IPC_STRUCT_TRAITS_END()
35 IPC_STRUCT_TRAITS_BEGIN(base::trace_event::MemoryDumpArgs
)
36 IPC_STRUCT_TRAITS_MEMBER(level_of_detail
)
37 IPC_STRUCT_TRAITS_END()
39 IPC_ENUM_TRAITS_MAX_VALUE(base::trace_event::MemoryDumpLevelOfDetail
,
40 base::trace_event::MemoryDumpLevelOfDetail::LAST
)
42 IPC_ENUM_TRAITS_MAX_VALUE(
43 base::trace_event::MemoryDumpType
,
44 static_cast<int>(base::trace_event::MemoryDumpType::LAST
))
46 // Sent to all child processes to enable trace event recording.
47 IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing
,
48 std::string
/* trace_config_str */,
49 base::TraceTicks
/* browser_time */,
50 uint64
/* Tracing process id (hash of child id) */)
52 // Sent to all child processes to disable trace event recording.
53 IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing
)
55 // Sent to all child processes to cancel trace event recording.
56 IPC_MESSAGE_CONTROL0(TracingMsg_CancelTracing
)
58 // Sent to all child processes to start monitoring.
59 IPC_MESSAGE_CONTROL2(TracingMsg_EnableMonitoring
,
60 std::string
/* trace_config_str */,
61 base::TraceTicks
/* browser_time */)
63 // Sent to all child processes to stop monitoring.
64 IPC_MESSAGE_CONTROL0(TracingMsg_DisableMonitoring
)
66 // Sent to all child processes to capture the current monitorint snapshot.
67 IPC_MESSAGE_CONTROL0(TracingMsg_CaptureMonitoringSnapshot
)
69 // Sent to all child processes to get trace buffer fullness.
70 IPC_MESSAGE_CONTROL0(TracingMsg_GetTraceLogStatus
)
72 // Sent to all child processes to set watch event.
73 IPC_MESSAGE_CONTROL2(TracingMsg_SetWatchEvent
,
74 std::string
/* category_name */,
75 std::string
/* event_name */)
77 // Sent to all child processes to clear watch event.
78 IPC_MESSAGE_CONTROL0(TracingMsg_CancelWatchEvent
)
80 // Sent to all child processes to request a local (current process) memory dump.
81 IPC_MESSAGE_CONTROL1(TracingMsg_ProcessMemoryDumpRequest
,
82 base::trace_event::MemoryDumpRequestArgs
)
84 // Reply to TracingHostMsg_GlobalMemoryDumpRequest, sent by the browser process.
85 // This is to get the result of a global dump initiated by a child process.
86 IPC_MESSAGE_CONTROL2(TracingMsg_GlobalMemoryDumpResponse
,
87 uint64
/* dump_guid */,
90 IPC_MESSAGE_CONTROL3(TracingMsg_SetUMACallback
,
91 std::string
/* histogram_name */,
92 base::HistogramBase::Sample
/* histogram_lower_value */,
93 base::HistogramBase::Sample
/* histogram_uppwer_value */)
95 IPC_MESSAGE_CONTROL1(TracingMsg_ClearUMACallback
,
96 std::string
/* histogram_name */)
98 // Sent everytime when a watch event is matched.
99 IPC_MESSAGE_CONTROL0(TracingHostMsg_WatchEventMatched
)
101 // Notify the browser that this child process supports tracing.
102 IPC_MESSAGE_CONTROL0(TracingHostMsg_ChildSupportsTracing
)
104 // Reply from child processes acking TracingMsg_EndTracing.
105 IPC_MESSAGE_CONTROL1(TracingHostMsg_EndTracingAck
,
106 std::vector
<std::string
> /* known_categories */)
108 // Reply from child processes acking TracingMsg_CaptureMonitoringSnapshot.
109 IPC_MESSAGE_CONTROL0(TracingHostMsg_CaptureMonitoringSnapshotAck
)
111 // Child processes send back trace data in JSON chunks.
112 IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceDataCollected
,
113 std::string
/*json trace data*/)
115 // Child processes send back trace data of the current monitoring
117 IPC_MESSAGE_CONTROL1(TracingHostMsg_MonitoringTraceDataCollected
,
118 std::string
/*json trace data*/)
120 // Reply to TracingMsg_GetTraceLogStatus.
121 IPC_MESSAGE_CONTROL1(
122 TracingHostMsg_TraceLogStatusReply
,
123 base::trace_event::TraceLogStatus
/*status of the trace log*/)
125 // Sent to the browser to initiate a global memory dump from a child process.
126 IPC_MESSAGE_CONTROL1(TracingHostMsg_GlobalMemoryDumpRequest
,
127 base::trace_event::MemoryDumpRequestArgs
)
129 // Reply to TracingMsg_ProcessMemoryDumpRequest.
130 IPC_MESSAGE_CONTROL2(TracingHostMsg_ProcessMemoryDumpResponse
,
131 uint64
/* dump_guid */,
134 IPC_MESSAGE_CONTROL1(TracingHostMsg_TriggerBackgroundTrace
,
135 std::string
/* name */)