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 #if defined(OS_MACOSX)
21 #include "content/common/mac/io_surface_manager_token.h"
24 IPC_ENUM_TRAITS_MAX_VALUE(tracked_objects::ThreadData::Status
,
25 tracked_objects::ThreadData::STATUS_LAST
)
27 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::LocationSnapshot
)
28 IPC_STRUCT_TRAITS_MEMBER(file_name
)
29 IPC_STRUCT_TRAITS_MEMBER(function_name
)
30 IPC_STRUCT_TRAITS_MEMBER(line_number
)
31 IPC_STRUCT_TRAITS_END()
33 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::BirthOnThreadSnapshot
)
34 IPC_STRUCT_TRAITS_MEMBER(location
)
35 IPC_STRUCT_TRAITS_MEMBER(thread_name
)
36 IPC_STRUCT_TRAITS_END()
38 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::DeathDataSnapshot
)
39 IPC_STRUCT_TRAITS_MEMBER(count
)
40 IPC_STRUCT_TRAITS_MEMBER(run_duration_sum
)
41 IPC_STRUCT_TRAITS_MEMBER(run_duration_max
)
42 IPC_STRUCT_TRAITS_MEMBER(run_duration_sample
)
43 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum
)
44 IPC_STRUCT_TRAITS_MEMBER(queue_duration_max
)
45 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample
)
46 IPC_STRUCT_TRAITS_END()
48 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::TaskSnapshot
)
49 IPC_STRUCT_TRAITS_MEMBER(birth
)
50 IPC_STRUCT_TRAITS_MEMBER(death_data
)
51 IPC_STRUCT_TRAITS_MEMBER(death_thread_name
)
52 IPC_STRUCT_TRAITS_END()
54 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataPhaseSnapshot
)
55 IPC_STRUCT_TRAITS_MEMBER(tasks
)
56 IPC_STRUCT_TRAITS_END()
58 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot
)
59 IPC_STRUCT_TRAITS_MEMBER(phased_snapshots
)
60 IPC_STRUCT_TRAITS_MEMBER(process_id
)
61 IPC_STRUCT_TRAITS_END()
63 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType
,
64 gfx::GPU_MEMORY_BUFFER_TYPE_LAST
)
66 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle
)
67 IPC_STRUCT_TRAITS_MEMBER(id
)
68 IPC_STRUCT_TRAITS_MEMBER(type
)
69 IPC_STRUCT_TRAITS_MEMBER(handle
)
70 IPC_STRUCT_TRAITS_END()
72 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Format
,
73 gfx::GpuMemoryBuffer::FORMAT_LAST
)
75 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Usage
,
76 gfx::GpuMemoryBuffer::USAGE_LAST
)
78 #undef IPC_MESSAGE_EXPORT
79 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
81 #define IPC_MESSAGE_START ChildProcessMsgStart
83 // Messages sent from the browser to the child process.
85 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
86 // process that it's safe to shutdown.
87 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown
)
89 #if defined(IPC_MESSAGE_LOG_ENABLED)
90 // Tell the child process to begin or end IPC message logging.
91 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled
,
95 // Tell the child process to enable or disable the profiler status.
96 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus
,
97 tracked_objects::ThreadData::Status
/* profiler status */)
99 // Send to all the child processes to send back profiler data (ThreadData in
101 IPC_MESSAGE_CONTROL2(ChildProcessMsg_GetChildProfilerData
,
102 int /* sequence_number */,
103 int /* current_profiling_phase */)
105 // Send to all the child processes to mark the current profiling phase as
106 // finished and start a new phase.
107 IPC_MESSAGE_CONTROL1(ChildProcessMsg_ProfilingPhaseCompleted
,
108 int /* profiling_phase */)
110 // Send to all the child processes to send back histogram data.
111 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData
,
112 int /* sequence_number */)
114 // Sent to child processes to tell them to enter or leave background mode.
115 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProcessBackgrounded
,
116 bool /* background */)
118 #if defined(USE_TCMALLOC)
119 // Sent to child process to request tcmalloc stats.
120 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats
)
123 #if defined(OS_MACOSX)
124 // Sent to child processes to tell them what token to use when registering
125 // and/or acquiring IOSurfaces.
126 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIOSurfaceManagerToken
,
127 content::IOSurfaceManagerToken
/* token */)
130 ////////////////////////////////////////////////////////////////////////////////
131 // Messages sent from the child process to the browser.
133 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest
)
135 // Send back profiler data (ThreadData in tracked_objects).
136 IPC_MESSAGE_CONTROL2(
137 ChildProcessHostMsg_ChildProfilerData
,
138 int, /* sequence_number */
139 tracked_objects::ProcessDataSnapshot
/* process_data_snapshot */)
141 // Send back histograms as vector of pickled-histogram strings.
142 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData
,
143 int, /* sequence_number */
144 std::vector
<std::string
> /* histogram_data */)
146 // Request a histogram from the browser. The browser will send the histogram
147 // data only if it has been passed the command line flag
148 // switches::kDomAutomationController.
149 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram
,
150 std::string
, /* histogram_name */
151 std::string
/* histogram_json */)
154 // Request that the given font be loaded by the host so it's cached by the
155 // OS. Please see ChildProcessHost::PreCacheFont for details.
156 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont
,
157 LOGFONT
/* font data */)
159 // Release the cached font
160 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts
)
161 #endif // defined(OS_WIN)
163 // Asks the browser to create a block of shared memory for the child process to
164 // fill in and pass back to the browser.
165 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory
,
166 uint32
/* buffer size */,
167 base::SharedMemoryHandle
)
169 // Asks the browser to create a block of shared memory for the child process to
170 // fill in and pass back to the browser.
171 IPC_SYNC_MESSAGE_CONTROL2_1(ChildProcessHostMsg_SyncAllocateSharedBitmap
,
172 uint32
/* buffer size */,
174 base::SharedMemoryHandle
)
176 // Informs the browser that the child allocated a shared bitmap.
177 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_AllocatedSharedBitmap
,
178 uint32
/* buffer size */,
179 base::SharedMemoryHandle
,
182 // Informs the browser that the child deleted a shared bitmap.
183 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedSharedBitmap
,
186 #if defined(USE_TCMALLOC)
187 // Reply to ChildProcessMsg_GetTcmallocStats.
188 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats
,
189 std::string
/* output */)
192 // Asks the browser to create a gpu memory buffer.
193 IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer
,
196 gfx::GpuMemoryBuffer::Format
,
197 gfx::GpuMemoryBuffer::Usage
,
198 gfx::GpuMemoryBufferHandle
)
200 // Informs the browser that the child deleted a gpu memory buffer.
201 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_DeletedGpuMemoryBuffer
,
202 gfx::GpuMemoryBufferId
,
203 uint32
/* sync_point */)
205 // Asks the browser to create a block of discardable shared memory for the
207 IPC_SYNC_MESSAGE_CONTROL2_1(
208 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory
,
210 content::DiscardableSharedMemoryId
,
211 base::SharedMemoryHandle
)
213 // Informs the browser that the child deleted a block of discardable shared
215 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedDiscardableSharedMemory
,
216 content::DiscardableSharedMemoryId
)