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 // Common IPC messages used for child processes.
6 // Multiply-included message file, hence no include guard.
11 #include "base/memory/shared_memory.h"
12 #include "base/tracked_objects.h"
13 #include "base/values.h"
14 #include "content/common/content_export.h"
15 #include "ipc/ipc_message_macros.h"
17 IPC_ENUM_TRAITS(tracked_objects::ThreadData::Status
)
19 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::LocationSnapshot
)
20 IPC_STRUCT_TRAITS_MEMBER(file_name
)
21 IPC_STRUCT_TRAITS_MEMBER(function_name
)
22 IPC_STRUCT_TRAITS_MEMBER(line_number
)
23 IPC_STRUCT_TRAITS_END()
25 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::BirthOnThreadSnapshot
)
26 IPC_STRUCT_TRAITS_MEMBER(location
)
27 IPC_STRUCT_TRAITS_MEMBER(thread_name
)
28 IPC_STRUCT_TRAITS_END()
30 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::DeathDataSnapshot
)
31 IPC_STRUCT_TRAITS_MEMBER(count
)
32 IPC_STRUCT_TRAITS_MEMBER(run_duration_sum
)
33 IPC_STRUCT_TRAITS_MEMBER(run_duration_max
)
34 IPC_STRUCT_TRAITS_MEMBER(run_duration_sample
)
35 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum
)
36 IPC_STRUCT_TRAITS_MEMBER(queue_duration_max
)
37 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample
)
38 IPC_STRUCT_TRAITS_END()
40 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::TaskSnapshot
)
41 IPC_STRUCT_TRAITS_MEMBER(birth
)
42 IPC_STRUCT_TRAITS_MEMBER(death_data
)
43 IPC_STRUCT_TRAITS_MEMBER(death_thread_name
)
44 IPC_STRUCT_TRAITS_END()
46 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ParentChildPairSnapshot
)
47 IPC_STRUCT_TRAITS_MEMBER(parent
)
48 IPC_STRUCT_TRAITS_MEMBER(child
)
49 IPC_STRUCT_TRAITS_END()
51 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot
)
52 IPC_STRUCT_TRAITS_MEMBER(tasks
)
53 IPC_STRUCT_TRAITS_MEMBER(descendants
)
54 IPC_STRUCT_TRAITS_MEMBER(process_id
)
55 IPC_STRUCT_TRAITS_END()
57 #undef IPC_MESSAGE_EXPORT
58 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
60 #define IPC_MESSAGE_START ChildProcessMsgStart
62 // Messages sent from the browser to the child process.
64 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
65 // process that it's safe to shutdown.
66 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown
)
68 #if defined(IPC_MESSAGE_LOG_ENABLED)
69 // Tell the child process to begin or end IPC message logging.
70 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled
,
74 // Tell the child process to enable or disable the profiler status.
75 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus
,
76 tracked_objects::ThreadData::Status
/* profiler status */)
78 // Send to all the child processes to send back profiler data (ThreadData in
80 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData
,
81 int /* sequence_number */)
83 // Send to all the child processes to send back histogram data.
84 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData
,
85 int /* sequence_number */)
87 // Sent to child processes to dump their handle table.
88 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles
)
90 #if defined(USE_TCMALLOC)
91 // Sent to child process to request tcmalloc stats.
92 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats
)
95 ////////////////////////////////////////////////////////////////////////////////
96 // Messages sent from the child process to the browser.
98 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest
)
100 // Send back profiler data (ThreadData in tracked_objects).
101 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData
,
102 int, /* sequence_number */
103 tracked_objects::ProcessDataSnapshot
/* profiler_data */)
105 // Send back histograms as vector of pickled-histogram strings.
106 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData
,
107 int, /* sequence_number */
108 std::vector
<std::string
> /* histogram_data */)
110 // Request a histogram from the browser. The browser will send the histogram
111 // data only if it has been passed the command line flag
112 // switches::kDomAutomationController.
113 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram
,
114 std::string
, /* histogram_name */
115 std::string
/* histogram_json */)
117 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
118 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone
)
121 // Request that the given font be loaded by the host so it's cached by the
122 // OS. Please see ChildProcessHost::PreCacheFont for details.
123 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont
,
124 LOGFONT
/* font data */)
126 // Release the cached font
127 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts
)
128 #endif // defined(OS_WIN)
130 // Asks the browser to create a block of shared memory for the child process to
131 // fill in and pass back to the browser.
132 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory
,
133 uint32
/* buffer size */,
134 base::SharedMemoryHandle
)
136 #if defined(USE_TCMALLOC)
137 // Reply to ChildProcessMsg_GetTcmallocStats.
138 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats
,
139 std::string
/* output */)