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_CONTROL2(TracingMsg_SetUMACallback
,
91 std::string
/* histogram_name */,
92 base::HistogramBase::Sample
/* histogram_value */)
94 IPC_MESSAGE_CONTROL1(TracingMsg_ClearUMACallback
,
95 std::string
/* histogram_name */)
97 // Sent everytime when a watch event is matched.
98 IPC_MESSAGE_CONTROL0(TracingHostMsg_WatchEventMatched
)
100 // Notify the browser that this child process supports tracing.
101 IPC_MESSAGE_CONTROL0(TracingHostMsg_ChildSupportsTracing
)
103 // Reply from child processes acking TracingMsg_EndTracing.
104 IPC_MESSAGE_CONTROL1(TracingHostMsg_EndTracingAck
,
105 std::vector
<std::string
> /* known_categories */)
107 // Reply from child processes acking TracingMsg_CaptureMonitoringSnapshot.
108 IPC_MESSAGE_CONTROL0(TracingHostMsg_CaptureMonitoringSnapshotAck
)
110 // Child processes send back trace data in JSON chunks.
111 IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceDataCollected
,
112 std::string
/*json trace data*/)
114 // Child processes send back trace data of the current monitoring
116 IPC_MESSAGE_CONTROL1(TracingHostMsg_MonitoringTraceDataCollected
,
117 std::string
/*json trace data*/)
119 // Reply to TracingMsg_GetTraceLogStatus.
120 IPC_MESSAGE_CONTROL1(
121 TracingHostMsg_TraceLogStatusReply
,
122 base::trace_event::TraceLogStatus
/*status of the trace log*/)
124 // Sent to the browser to initiate a global memory dump from a child process.
125 IPC_MESSAGE_CONTROL1(TracingHostMsg_GlobalMemoryDumpRequest
,
126 base::trace_event::MemoryDumpRequestArgs
)
128 // Reply to TracingMsg_ProcessMemoryDumpRequest.
129 IPC_MESSAGE_CONTROL2(TracingHostMsg_ProcessMemoryDumpResponse
,
130 uint64
/* dump_guid */,
133 IPC_MESSAGE_CONTROL1(TracingHostMsg_TriggerBackgroundTrace
,
134 std::string
/* name */)