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(dump_args
)
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(
40 base::trace_event::MemoryDumpArgs::LevelOfDetail
,
41 base::trace_event::MemoryDumpArgs::LevelOfDetail::LAST
)
43 IPC_ENUM_TRAITS_MAX_VALUE(
44 base::trace_event::MemoryDumpType
,
45 static_cast<int>(base::trace_event::MemoryDumpType::LAST
))
47 // Sent to all child processes to enable trace event recording.
48 IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing
,
49 std::string
/* trace_config_str */,
50 base::TraceTicks
/* browser_time */,
51 uint64
/* Tracing process id (hash of child id) */)
53 // Sent to all child processes to disable trace event recording.
54 IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing
)
56 // Sent to all child processes to cancel trace event recording.
57 IPC_MESSAGE_CONTROL0(TracingMsg_CancelTracing
)
59 // Sent to all child processes to start monitoring.
60 IPC_MESSAGE_CONTROL2(TracingMsg_EnableMonitoring
,
61 std::string
/* trace_config_str */,
62 base::TraceTicks
/* browser_time */)
64 // Sent to all child processes to stop monitoring.
65 IPC_MESSAGE_CONTROL0(TracingMsg_DisableMonitoring
)
67 // Sent to all child processes to capture the current monitorint snapshot.
68 IPC_MESSAGE_CONTROL0(TracingMsg_CaptureMonitoringSnapshot
)
70 // Sent to all child processes to get trace buffer fullness.
71 IPC_MESSAGE_CONTROL0(TracingMsg_GetTraceLogStatus
)
73 // Sent to all child processes to set watch event.
74 IPC_MESSAGE_CONTROL2(TracingMsg_SetWatchEvent
,
75 std::string
/* category_name */,
76 std::string
/* event_name */)
78 // Sent to all child processes to clear watch event.
79 IPC_MESSAGE_CONTROL0(TracingMsg_CancelWatchEvent
)
81 // Sent to all child processes to request a local (current process) memory dump.
82 IPC_MESSAGE_CONTROL1(TracingMsg_ProcessMemoryDumpRequest
,
83 base::trace_event::MemoryDumpRequestArgs
)
85 // Reply to TracingHostMsg_GlobalMemoryDumpRequest, sent by the browser process.
86 // This is to get the result of a global dump initiated by a child process.
87 IPC_MESSAGE_CONTROL2(TracingMsg_GlobalMemoryDumpResponse
,
88 uint64
/* dump_guid */,
91 IPC_MESSAGE_CONTROL2(TracingMsg_SetUMACallback
,
92 std::string
/* histogram_name */,
93 base::HistogramBase::Sample
/* histogram_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 */)