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 "cc/resources/shared_bitmap_manager.h"
15 #include "content/common/content_export.h"
16 #include "content/common/host_discardable_shared_memory_manager.h"
17 #include "ipc/ipc_message_macros.h"
18 #include "ui/gfx/gpu_memory_buffer.h"
20 IPC_ENUM_TRAITS_MAX_VALUE(tracked_objects::ThreadData::Status
,
21 tracked_objects::ThreadData::STATUS_LAST
)
23 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::LocationSnapshot
)
24 IPC_STRUCT_TRAITS_MEMBER(file_name
)
25 IPC_STRUCT_TRAITS_MEMBER(function_name
)
26 IPC_STRUCT_TRAITS_MEMBER(line_number
)
27 IPC_STRUCT_TRAITS_END()
29 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::BirthOnThreadSnapshot
)
30 IPC_STRUCT_TRAITS_MEMBER(location
)
31 IPC_STRUCT_TRAITS_MEMBER(thread_name
)
32 IPC_STRUCT_TRAITS_END()
34 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::DeathDataSnapshot
)
35 IPC_STRUCT_TRAITS_MEMBER(count
)
36 IPC_STRUCT_TRAITS_MEMBER(run_duration_sum
)
37 IPC_STRUCT_TRAITS_MEMBER(run_duration_max
)
38 IPC_STRUCT_TRAITS_MEMBER(run_duration_sample
)
39 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum
)
40 IPC_STRUCT_TRAITS_MEMBER(queue_duration_max
)
41 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample
)
42 IPC_STRUCT_TRAITS_END()
44 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::TaskSnapshot
)
45 IPC_STRUCT_TRAITS_MEMBER(birth
)
46 IPC_STRUCT_TRAITS_MEMBER(death_data
)
47 IPC_STRUCT_TRAITS_MEMBER(death_thread_name
)
48 IPC_STRUCT_TRAITS_END()
50 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ParentChildPairSnapshot
)
51 IPC_STRUCT_TRAITS_MEMBER(parent
)
52 IPC_STRUCT_TRAITS_MEMBER(child
)
53 IPC_STRUCT_TRAITS_END()
55 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot
)
56 IPC_STRUCT_TRAITS_MEMBER(tasks
)
57 IPC_STRUCT_TRAITS_MEMBER(descendants
)
58 IPC_STRUCT_TRAITS_MEMBER(process_id
)
59 IPC_STRUCT_TRAITS_END()
61 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType
,
62 gfx::GPU_MEMORY_BUFFER_TYPE_LAST
)
64 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle
)
65 IPC_STRUCT_TRAITS_MEMBER(id
)
66 IPC_STRUCT_TRAITS_MEMBER(type
)
67 IPC_STRUCT_TRAITS_MEMBER(handle
)
68 #if defined(OS_MACOSX)
69 IPC_STRUCT_TRAITS_MEMBER(io_surface_id
)
71 IPC_STRUCT_TRAITS_END()
73 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Format
,
74 gfx::GpuMemoryBuffer::FORMAT_LAST
)
76 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Usage
,
77 gfx::GpuMemoryBuffer::USAGE_LAST
)
79 #undef IPC_MESSAGE_EXPORT
80 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
82 #define IPC_MESSAGE_START ChildProcessMsgStart
84 // Messages sent from the browser to the child process.
86 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
87 // process that it's safe to shutdown.
88 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown
)
90 #if defined(IPC_MESSAGE_LOG_ENABLED)
91 // Tell the child process to begin or end IPC message logging.
92 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled
,
96 // Tell the child process to enable or disable the profiler status.
97 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus
,
98 tracked_objects::ThreadData::Status
/* profiler status */)
100 // Send to all the child processes to send back profiler data (ThreadData in
102 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData
,
103 int /* sequence_number */)
105 // Send to all the child processes to send back histogram data.
106 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData
,
107 int /* sequence_number */)
109 // Sent to child processes to dump their handle table.
110 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles
)
112 // Sent to child processes to tell them to enter or leave background mode.
113 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProcessBackgrounded
,
114 bool /* background */)
116 #if defined(USE_TCMALLOC)
117 // Sent to child process to request tcmalloc stats.
118 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats
)
121 ////////////////////////////////////////////////////////////////////////////////
122 // Messages sent from the child process to the browser.
124 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest
)
126 // Send back profiler data (ThreadData in tracked_objects).
127 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData
,
128 int, /* sequence_number */
129 tracked_objects::ProcessDataSnapshot
/* profiler_data */)
131 // Send back histograms as vector of pickled-histogram strings.
132 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData
,
133 int, /* sequence_number */
134 std::vector
<std::string
> /* histogram_data */)
136 // Request a histogram from the browser. The browser will send the histogram
137 // data only if it has been passed the command line flag
138 // switches::kDomAutomationController.
139 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram
,
140 std::string
, /* histogram_name */
141 std::string
/* histogram_json */)
143 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
144 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone
)
147 // Request that the given font be loaded by the host so it's cached by the
148 // OS. Please see ChildProcessHost::PreCacheFont for details.
149 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont
,
150 LOGFONT
/* font data */)
152 // Release the cached font
153 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts
)
154 #endif // defined(OS_WIN)
156 // Asks the browser to create a block of shared memory for the child process to
157 // fill in and pass back to the browser.
158 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory
,
159 uint32
/* buffer size */,
160 base::SharedMemoryHandle
)
162 // Asks the browser to create a block of shared memory for the child process to
163 // fill in and pass back to the browser.
164 IPC_SYNC_MESSAGE_CONTROL2_1(ChildProcessHostMsg_SyncAllocateSharedBitmap
,
165 uint32
/* buffer size */,
167 base::SharedMemoryHandle
)
169 // Informs the browser that the child allocated a shared bitmap.
170 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_AllocatedSharedBitmap
,
171 uint32
/* buffer size */,
172 base::SharedMemoryHandle
,
175 // Informs the browser that the child deleted a shared bitmap.
176 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedSharedBitmap
,
179 #if defined(USE_TCMALLOC)
180 // Reply to ChildProcessMsg_GetTcmallocStats.
181 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats
,
182 std::string
/* output */)
185 // Asks the browser to create a gpu memory buffer.
186 IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer
,
189 gfx::GpuMemoryBuffer::Format
,
190 gfx::GpuMemoryBuffer::Usage
,
191 gfx::GpuMemoryBufferHandle
)
193 // Informs the browser that the child deleted a gpu memory buffer.
194 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_DeletedGpuMemoryBuffer
,
195 gfx::GpuMemoryBufferId
,
196 uint32
/* sync_point */)
198 // Asks the browser to create a block of discardable shared memory for the
200 IPC_SYNC_MESSAGE_CONTROL2_1(
201 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory
,
203 content::DiscardableSharedMemoryId
,
204 base::SharedMemoryHandle
)
206 // Informs the browser that the child deleted a block of discardable shared
208 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedDiscardableSharedMemory
,
209 content::DiscardableSharedMemoryId
)