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 "ipc/ipc_message_macros.h"
17 #include "ui/gfx/gpu_memory_buffer.h"
19 IPC_ENUM_TRAITS_MAX_VALUE(tracked_objects::ThreadData::Status
,
20 tracked_objects::ThreadData::STATUS_LAST
)
22 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::LocationSnapshot
)
23 IPC_STRUCT_TRAITS_MEMBER(file_name
)
24 IPC_STRUCT_TRAITS_MEMBER(function_name
)
25 IPC_STRUCT_TRAITS_MEMBER(line_number
)
26 IPC_STRUCT_TRAITS_END()
28 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::BirthOnThreadSnapshot
)
29 IPC_STRUCT_TRAITS_MEMBER(location
)
30 IPC_STRUCT_TRAITS_MEMBER(thread_name
)
31 IPC_STRUCT_TRAITS_END()
33 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::DeathDataSnapshot
)
34 IPC_STRUCT_TRAITS_MEMBER(count
)
35 IPC_STRUCT_TRAITS_MEMBER(run_duration_sum
)
36 IPC_STRUCT_TRAITS_MEMBER(run_duration_max
)
37 IPC_STRUCT_TRAITS_MEMBER(run_duration_sample
)
38 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sum
)
39 IPC_STRUCT_TRAITS_MEMBER(queue_duration_max
)
40 IPC_STRUCT_TRAITS_MEMBER(queue_duration_sample
)
41 IPC_STRUCT_TRAITS_END()
43 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::TaskSnapshot
)
44 IPC_STRUCT_TRAITS_MEMBER(birth
)
45 IPC_STRUCT_TRAITS_MEMBER(death_data
)
46 IPC_STRUCT_TRAITS_MEMBER(death_thread_name
)
47 IPC_STRUCT_TRAITS_END()
49 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ParentChildPairSnapshot
)
50 IPC_STRUCT_TRAITS_MEMBER(parent
)
51 IPC_STRUCT_TRAITS_MEMBER(child
)
52 IPC_STRUCT_TRAITS_END()
54 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot
)
55 IPC_STRUCT_TRAITS_MEMBER(tasks
)
56 IPC_STRUCT_TRAITS_MEMBER(descendants
)
57 IPC_STRUCT_TRAITS_MEMBER(process_id
)
58 IPC_STRUCT_TRAITS_END()
60 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType
,
61 gfx::GPU_MEMORY_BUFFER_TYPE_LAST
)
63 #if defined(OS_ANDROID)
64 IPC_STRUCT_TRAITS_BEGIN(gfx::SurfaceTextureId
)
65 IPC_STRUCT_TRAITS_MEMBER(primary_id
)
66 IPC_STRUCT_TRAITS_MEMBER(secondary_id
)
67 IPC_STRUCT_TRAITS_END()
70 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferId
)
71 IPC_STRUCT_TRAITS_MEMBER(primary_id
)
72 IPC_STRUCT_TRAITS_MEMBER(secondary_id
)
73 IPC_STRUCT_TRAITS_END()
75 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle
)
76 IPC_STRUCT_TRAITS_MEMBER(type
)
77 IPC_STRUCT_TRAITS_MEMBER(handle
)
78 IPC_STRUCT_TRAITS_MEMBER(global_id
)
79 #if defined(OS_MACOSX)
80 IPC_STRUCT_TRAITS_MEMBER(io_surface_id
)
82 #if defined(OS_ANDROID)
83 IPC_STRUCT_TRAITS_MEMBER(surface_texture_id
)
85 IPC_STRUCT_TRAITS_END()
87 #undef IPC_MESSAGE_EXPORT
88 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
90 #define IPC_MESSAGE_START ChildProcessMsgStart
92 // Messages sent from the browser to the child process.
94 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
95 // process that it's safe to shutdown.
96 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown
)
98 #if defined(IPC_MESSAGE_LOG_ENABLED)
99 // Tell the child process to begin or end IPC message logging.
100 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled
,
101 bool /* on or off */)
104 // Tell the child process to enable or disable the profiler status.
105 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus
,
106 tracked_objects::ThreadData::Status
/* profiler status */)
108 // Send to all the child processes to send back profiler data (ThreadData in
110 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData
,
111 int /* sequence_number */)
113 // Send to all the child processes to send back histogram data.
114 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData
,
115 int /* sequence_number */)
117 // Sent to child processes to dump their handle table.
118 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles
)
120 // Sent to child processes to tell them to enter or leave background mode.
121 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProcessBackgrounded
,
122 bool /* background */)
124 #if defined(USE_TCMALLOC)
125 // Sent to child process to request tcmalloc stats.
126 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats
)
129 ////////////////////////////////////////////////////////////////////////////////
130 // Messages sent from the child process to the browser.
132 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest
)
134 // Send back profiler data (ThreadData in tracked_objects).
135 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData
,
136 int, /* sequence_number */
137 tracked_objects::ProcessDataSnapshot
/* profiler_data */)
139 // Send back histograms as vector of pickled-histogram strings.
140 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData
,
141 int, /* sequence_number */
142 std::vector
<std::string
> /* histogram_data */)
144 // Request a histogram from the browser. The browser will send the histogram
145 // data only if it has been passed the command line flag
146 // switches::kDomAutomationController.
147 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram
,
148 std::string
, /* histogram_name */
149 std::string
/* histogram_json */)
151 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
152 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone
)
155 // Request that the given font be loaded by the host so it's cached by the
156 // OS. Please see ChildProcessHost::PreCacheFont for details.
157 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont
,
158 LOGFONT
/* font data */)
160 // Release the cached font
161 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts
)
162 #endif // defined(OS_WIN)
164 // Asks the browser to create a block of shared memory for the child process to
165 // fill in and pass back to the browser.
166 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory
,
167 uint32
/* buffer size */,
168 base::SharedMemoryHandle
)
170 // Asks the browser to create a block of shared memory for the child process to
171 // fill in and pass back to the browser.
172 IPC_SYNC_MESSAGE_CONTROL2_1(ChildProcessHostMsg_SyncAllocateSharedBitmap
,
173 uint32
/* buffer size */,
175 base::SharedMemoryHandle
)
177 // Informs the browser that the child allocated a shared bitmap.
178 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_AllocatedSharedBitmap
,
179 uint32
/* buffer size */,
180 base::SharedMemoryHandle
,
183 // Informs the browser that the child deleted a shared bitmap.
184 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedSharedBitmap
,
187 #if defined(USE_TCMALLOC)
188 // Reply to ChildProcessMsg_GetTcmallocStats.
189 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats
,
190 std::string
/* output */)
193 // Asks the browser to create a gpu memory buffer.
194 IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer
,
197 uint32
/* internalformat */,
199 gfx::GpuMemoryBufferHandle
)