Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / common / child_process_messages.h
blob948b60ed49a1192a59b0b201bc4c61cf4c6633c5
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.
8 #include <string>
9 #include <vector>
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 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle)
64 IPC_STRUCT_TRAITS_MEMBER(id)
65 IPC_STRUCT_TRAITS_MEMBER(type)
66 IPC_STRUCT_TRAITS_MEMBER(handle)
67 #if defined(OS_MACOSX)
68 IPC_STRUCT_TRAITS_MEMBER(io_surface_id)
69 #endif
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,
92 bool /* on or off */)
93 #endif
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
100 // tracked_objects).
101 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData,
102 int /* sequence_number */)
104 // Send to all the child processes to send back histogram data.
105 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData,
106 int /* sequence_number */)
108 // Sent to child processes to dump their handle table.
109 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles)
111 // Sent to child processes to tell them to enter or leave background mode.
112 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProcessBackgrounded,
113 bool /* background */)
115 #if defined(USE_TCMALLOC)
116 // Sent to child process to request tcmalloc stats.
117 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats)
118 #endif
120 ////////////////////////////////////////////////////////////////////////////////
121 // Messages sent from the child process to the browser.
123 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest)
125 // Send back profiler data (ThreadData in tracked_objects).
126 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildProfilerData,
127 int, /* sequence_number */
128 tracked_objects::ProcessDataSnapshot /* profiler_data */)
130 // Send back histograms as vector of pickled-histogram strings.
131 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData,
132 int, /* sequence_number */
133 std::vector<std::string> /* histogram_data */)
135 // Request a histogram from the browser. The browser will send the histogram
136 // data only if it has been passed the command line flag
137 // switches::kDomAutomationController.
138 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram,
139 std::string, /* histogram_name */
140 std::string /* histogram_json */)
142 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
143 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone)
145 #if defined(OS_WIN)
146 // Request that the given font be loaded by the host so it's cached by the
147 // OS. Please see ChildProcessHost::PreCacheFont for details.
148 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont,
149 LOGFONT /* font data */)
151 // Release the cached font
152 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts)
153 #endif // defined(OS_WIN)
155 // Asks the browser to create a block of shared memory for the child process to
156 // fill in and pass back to the browser.
157 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory,
158 uint32 /* buffer size */,
159 base::SharedMemoryHandle)
161 // Asks the browser to create a block of shared memory for the child process to
162 // fill in and pass back to the browser.
163 IPC_SYNC_MESSAGE_CONTROL2_1(ChildProcessHostMsg_SyncAllocateSharedBitmap,
164 uint32 /* buffer size */,
165 cc::SharedBitmapId,
166 base::SharedMemoryHandle)
168 // Informs the browser that the child allocated a shared bitmap.
169 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_AllocatedSharedBitmap,
170 uint32 /* buffer size */,
171 base::SharedMemoryHandle,
172 cc::SharedBitmapId)
174 // Informs the browser that the child deleted a shared bitmap.
175 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedSharedBitmap,
176 cc::SharedBitmapId)
178 #if defined(USE_TCMALLOC)
179 // Reply to ChildProcessMsg_GetTcmallocStats.
180 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats,
181 std::string /* output */)
182 #endif
184 // Asks the browser to create a gpu memory buffer.
185 IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
186 uint32 /* width */,
187 uint32 /* height */,
188 gfx::GpuMemoryBuffer::Format,
189 gfx::GpuMemoryBuffer::Usage,
190 gfx::GpuMemoryBufferHandle)
192 // Informs the browser that the child deleted a gpu memory buffer.
193 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
194 gfx::GpuMemoryBufferId,
195 uint32 /* sync_point */)
197 // Asks the browser to create a block of discardable shared memory for the
198 // child process.
199 IPC_SYNC_MESSAGE_CONTROL1_1(
200 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory,
201 uint32 /* size */,
202 base::SharedMemoryHandle)