GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / common / child_process_messages.h
blob830cd62be0a3d48b16180cc70c050e764a7a62c5
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 "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::ProcessDataPhaseSnapshot)
56 IPC_STRUCT_TRAITS_MEMBER(tasks)
57 IPC_STRUCT_TRAITS_MEMBER(descendants)
58 IPC_STRUCT_TRAITS_END()
60 IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot)
61 IPC_STRUCT_TRAITS_MEMBER(phased_process_data_snapshots)
62 IPC_STRUCT_TRAITS_MEMBER(process_id)
63 IPC_STRUCT_TRAITS_END()
65 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType,
66 gfx::GPU_MEMORY_BUFFER_TYPE_LAST)
68 IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle)
69 IPC_STRUCT_TRAITS_MEMBER(id)
70 IPC_STRUCT_TRAITS_MEMBER(type)
71 IPC_STRUCT_TRAITS_MEMBER(handle)
72 #if defined(OS_MACOSX)
73 IPC_STRUCT_TRAITS_MEMBER(io_surface_id)
74 #endif
75 IPC_STRUCT_TRAITS_END()
77 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Format,
78 gfx::GpuMemoryBuffer::FORMAT_LAST)
80 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Usage,
81 gfx::GpuMemoryBuffer::USAGE_LAST)
83 #undef IPC_MESSAGE_EXPORT
84 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
86 #define IPC_MESSAGE_START ChildProcessMsgStart
88 // Messages sent from the browser to the child process.
90 // Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
91 // process that it's safe to shutdown.
92 IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown)
94 #if defined(IPC_MESSAGE_LOG_ENABLED)
95 // Tell the child process to begin or end IPC message logging.
96 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled,
97 bool /* on or off */)
98 #endif
100 // Tell the child process to enable or disable the profiler status.
101 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProfilerStatus,
102 tracked_objects::ThreadData::Status /* profiler status */)
104 // Send to all the child processes to send back profiler data (ThreadData in
105 // tracked_objects).
106 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildProfilerData,
107 int /* sequence_number */)
109 // Send to all the child processes to send back histogram data.
110 IPC_MESSAGE_CONTROL1(ChildProcessMsg_GetChildHistogramData,
111 int /* sequence_number */)
113 // Sent to child processes to dump their handle table.
114 IPC_MESSAGE_CONTROL0(ChildProcessMsg_DumpHandles)
116 // Sent to child processes to tell them to enter or leave background mode.
117 IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetProcessBackgrounded,
118 bool /* background */)
120 #if defined(USE_TCMALLOC)
121 // Sent to child process to request tcmalloc stats.
122 IPC_MESSAGE_CONTROL0(ChildProcessMsg_GetTcmallocStats)
123 #endif
125 ////////////////////////////////////////////////////////////////////////////////
126 // Messages sent from the child process to the browser.
128 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest)
130 // Send back profiler data (ThreadData in tracked_objects).
131 IPC_MESSAGE_CONTROL2(
132 ChildProcessHostMsg_ChildProfilerData,
133 int, /* sequence_number */
134 tracked_objects::ProcessDataSnapshot /* process_data_snapshot */)
136 // Send back histograms as vector of pickled-histogram strings.
137 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_ChildHistogramData,
138 int, /* sequence_number */
139 std::vector<std::string> /* histogram_data */)
141 // Request a histogram from the browser. The browser will send the histogram
142 // data only if it has been passed the command line flag
143 // switches::kDomAutomationController.
144 IPC_SYNC_MESSAGE_CONTROL1_1(ChildProcessHostMsg_GetBrowserHistogram,
145 std::string, /* histogram_name */
146 std::string /* histogram_json */)
148 // Reply to ChildProcessMsg_DumpHandles when handle table dump is complete.
149 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_DumpHandlesDone)
151 #if defined(OS_WIN)
152 // Request that the given font be loaded by the host so it's cached by the
153 // OS. Please see ChildProcessHost::PreCacheFont for details.
154 IPC_SYNC_MESSAGE_CONTROL1_0(ChildProcessHostMsg_PreCacheFont,
155 LOGFONT /* font data */)
157 // Release the cached font
158 IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ReleaseCachedFonts)
159 #endif // defined(OS_WIN)
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_CONTROL1_1(ChildProcessHostMsg_SyncAllocateSharedMemory,
164 uint32 /* buffer size */,
165 base::SharedMemoryHandle)
167 // Asks the browser to create a block of shared memory for the child process to
168 // fill in and pass back to the browser.
169 IPC_SYNC_MESSAGE_CONTROL2_1(ChildProcessHostMsg_SyncAllocateSharedBitmap,
170 uint32 /* buffer size */,
171 cc::SharedBitmapId,
172 base::SharedMemoryHandle)
174 // Informs the browser that the child allocated a shared bitmap.
175 IPC_MESSAGE_CONTROL3(ChildProcessHostMsg_AllocatedSharedBitmap,
176 uint32 /* buffer size */,
177 base::SharedMemoryHandle,
178 cc::SharedBitmapId)
180 // Informs the browser that the child deleted a shared bitmap.
181 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedSharedBitmap,
182 cc::SharedBitmapId)
184 #if defined(USE_TCMALLOC)
185 // Reply to ChildProcessMsg_GetTcmallocStats.
186 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TcmallocStats,
187 std::string /* output */)
188 #endif
190 // Asks the browser to create a gpu memory buffer.
191 IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
192 uint32 /* width */,
193 uint32 /* height */,
194 gfx::GpuMemoryBuffer::Format,
195 gfx::GpuMemoryBuffer::Usage,
196 gfx::GpuMemoryBufferHandle)
198 // Informs the browser that the child deleted a gpu memory buffer.
199 IPC_MESSAGE_CONTROL2(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
200 gfx::GpuMemoryBufferId,
201 uint32 /* sync_point */)
203 // Asks the browser to create a block of discardable shared memory for the
204 // child process.
205 IPC_SYNC_MESSAGE_CONTROL2_1(
206 ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory,
207 uint32 /* size */,
208 content::DiscardableSharedMemoryId,
209 base::SharedMemoryHandle)
211 // Informs the browser that the child deleted a block of discardable shared
212 // memory.
213 IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_DeletedDiscardableSharedMemory,
214 content::DiscardableSharedMemoryId)