Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 // Multiply-included message file, hence no include guard here, but see below | |
| 6 // for a much smaller-than-usual include guard section. | |
| 7 | |
| 8 #include "build/build_config.h" | |
| 9 #include "content/common/content_export.h" | |
| 10 #include "content/common/content_param_traits.h" | |
| 11 #include "content/common/gpu/establish_channel_params.h" | |
| 12 #include "content/common/gpu/gpu_memory_uma_stats.h" | |
| 13 #include "content/common/gpu/gpu_process_launch_causes.h" | |
| 14 #include "content/public/common/common_param_traits.h" | |
| 15 #include "content/public/common/gpu_memory_stats.h" | |
| 16 #include "gpu/command_buffer/common/sync_token.h" | |
| 17 #include "gpu/command_buffer/common/value_state.h" | |
| 18 #include "gpu/config/gpu_info.h" | |
| 19 #include "ipc/ipc_channel_handle.h" | |
| 20 #include "ipc/ipc_message_macros.h" | |
| 21 #include "ipc/ipc_message_start.h" | |
| 22 #include "ui/gfx/gpu_memory_buffer.h" | |
| 23 #include "ui/gfx/ipc/gfx_param_traits.h" | |
| 24 #include "ui/gfx/native_widget_types.h" | |
| 25 #include "url/gurl.h" | |
| 26 | |
| 27 #undef IPC_MESSAGE_EXPORT | |
| 28 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | |
| 29 | |
| 30 #define IPC_MESSAGE_START GpuMsgStart | |
|
piman
2016/02/18 03:40:24
Drive-by: you need a different (new) enum value he
Fady Samuel
2016/02/18 04:48:12
Done.
| |
| 31 | |
| 32 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch, | |
| 33 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1) | |
| 34 | |
| 35 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats) | |
| 36 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current) | |
| 37 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max) | |
| 38 IPC_STRUCT_TRAITS_END() | |
| 39 | |
| 40 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats) | |
| 41 IPC_STRUCT_TRAITS_MEMBER(process_map) | |
| 42 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated) | |
| 43 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max) | |
| 44 IPC_STRUCT_TRAITS_END() | |
| 45 | |
| 46 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats) | |
| 47 IPC_STRUCT_TRAITS_MEMBER(video_memory) | |
| 48 IPC_STRUCT_TRAITS_MEMBER(has_duplicates) | |
| 49 IPC_STRUCT_TRAITS_END() | |
| 50 | |
| 51 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params) | |
| 52 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id) | |
| 53 IPC_STRUCT_MEMBER(gfx::Size, size) | |
| 54 IPC_STRUCT_MEMBER(gfx::BufferFormat, format) | |
| 55 IPC_STRUCT_MEMBER(gfx::BufferUsage, usage) | |
| 56 IPC_STRUCT_MEMBER(int32_t, client_id) | |
| 57 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle) | |
| 58 IPC_STRUCT_END() | |
| 59 | |
| 60 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBufferFromHandle_Params) | |
| 61 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, handle) | |
| 62 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id) | |
| 63 IPC_STRUCT_MEMBER(gfx::Size, size) | |
| 64 IPC_STRUCT_MEMBER(gfx::BufferFormat, format) | |
| 65 IPC_STRUCT_MEMBER(int32_t, client_id) | |
| 66 IPC_STRUCT_END() | |
| 67 | |
| 68 IPC_STRUCT_TRAITS_BEGIN(content::EstablishChannelParams) | |
| 69 IPC_STRUCT_TRAITS_MEMBER(client_id) | |
| 70 IPC_STRUCT_TRAITS_MEMBER(client_tracing_id) | |
| 71 IPC_STRUCT_TRAITS_MEMBER(preempts) | |
| 72 IPC_STRUCT_TRAITS_MEMBER(allow_view_command_buffers) | |
| 73 IPC_STRUCT_TRAITS_MEMBER(allow_real_time_streams) | |
| 74 IPC_STRUCT_TRAITS_END() | |
| 75 | |
| 76 //------------------------------------------------------------------------------ | |
| 77 // GPU Messages | |
| 78 // These are messages from the browser to the GPU process. | |
| 79 | |
| 80 // Tells the GPU process to initialize itself. The browser explicitly | |
| 81 // requests this be done so that we are guaranteed that the channel is set | |
| 82 // up between the browser and GPU process before doing any work that might | |
| 83 // potentially crash the GPU process. Detection of the child process | |
| 84 // exiting abruptly is predicated on having the IPC channel set up. | |
| 85 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) | |
| 86 | |
| 87 // Tells the GPU process to shutdown itself. | |
| 88 IPC_MESSAGE_CONTROL0(GpuMsg_Finalize) | |
| 89 | |
| 90 // Tells the GPU process to create a new channel for communication with a | |
| 91 // given client. The channel name is returned in a | |
| 92 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that | |
| 93 // the GPU process reuses an existing channel to that process if it exists. | |
| 94 // This ID is a unique opaque identifier generated by the browser process. | |
| 95 // The client_tracing_id is a unique ID used for the purposes of tracing. | |
| 96 IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, | |
| 97 content::EstablishChannelParams /* params */) | |
| 98 | |
| 99 // Tells the GPU process to close the channel identified by IPC channel | |
| 100 // handle. If no channel can be identified, do nothing. | |
| 101 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, | |
| 102 IPC::ChannelHandle /* channel_handle */) | |
| 103 | |
| 104 // Tells the GPU process to create a new gpu memory buffer. | |
| 105 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer, | |
| 106 GpuMsg_CreateGpuMemoryBuffer_Params) | |
| 107 | |
| 108 // Tells the GPU process to create a new gpu memory buffer from an existing | |
| 109 // handle. | |
| 110 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBufferFromHandle, | |
| 111 GpuMsg_CreateGpuMemoryBufferFromHandle_Params) | |
| 112 | |
| 113 // Tells the GPU process to destroy buffer. | |
| 114 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer, | |
| 115 gfx::GpuMemoryBufferId, /* id */ | |
| 116 int32_t, /* client_id */ | |
| 117 gpu::SyncToken /* sync_token */) | |
| 118 | |
| 119 // Tells the GPU process to create a context for collecting graphics card | |
| 120 // information. | |
| 121 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) | |
| 122 | |
| 123 // Tells the GPU process to report video_memory information for the task manager | |
| 124 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats) | |
| 125 | |
| 126 #if defined(OS_MACOSX) | |
| 127 // Tells the GPU process that the browser process has handled the swap | |
| 128 // buffers or post sub-buffer request. | |
| 129 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented, | |
| 130 AcceleratedSurfaceMsg_BufferPresented_Params) | |
| 131 #endif | |
| 132 | |
| 133 #if defined(OS_ANDROID) | |
| 134 // Tells the GPU process to wake up the GPU because we're about to draw. | |
| 135 IPC_MESSAGE_CONTROL0(GpuMsg_WakeUpGpu) | |
| 136 #endif | |
| 137 | |
| 138 // Tells the GPU process to remove all contexts. | |
| 139 IPC_MESSAGE_CONTROL0(GpuMsg_Clean) | |
| 140 | |
| 141 // Tells the GPU process to crash. | |
| 142 IPC_MESSAGE_CONTROL0(GpuMsg_Crash) | |
| 143 | |
| 144 // Tells the GPU process to hang. | |
| 145 IPC_MESSAGE_CONTROL0(GpuMsg_Hang) | |
| 146 | |
| 147 // Tells the GPU process to disable the watchdog thread. | |
| 148 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog) | |
| 149 | |
| 150 // Tells the GPU process that the browser has seen a GPU switch. | |
| 151 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched) | |
| 152 | |
| 153 // Sends an input event to the gpu service. | |
| 154 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState, | |
| 155 int, /* client_id */ | |
| 156 unsigned int, /* target */ | |
| 157 gpu::ValueState /* valuestate */) | |
| 158 | |
| 159 //------------------------------------------------------------------------------ | |
| 160 // GPU Host Messages | |
| 161 // These are messages to the browser. | |
| 162 | |
| 163 // A renderer sends this when it wants to create a connection to the GPU | |
| 164 // process. The browser will create the GPU process if necessary, and will | |
| 165 // return a handle to the channel via a GpuChannelEstablished message. | |
| 166 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel, | |
| 167 content::CauseForGpuLaunch, | |
| 168 int /* client id */, | |
| 169 IPC::ChannelHandle /* handle to channel */, | |
| 170 gpu::GPUInfo /* stats about GPU process*/) | |
| 171 | |
| 172 // A renderer sends this when it wants to know whether a gpu process exists. | |
| 173 IPC_SYNC_MESSAGE_CONTROL0_1(GpuHostMsg_HasGpuProcess, bool /* result */) | |
| 174 | |
| 175 // Response from GPU to a GputMsg_Initialize message. | |
| 176 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized, | |
| 177 bool /* result */, | |
| 178 ::gpu::GPUInfo /* gpu_info */) | |
| 179 | |
| 180 // Response from GPU to a GpuHostMsg_EstablishChannel message. | |
| 181 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished, | |
| 182 IPC::ChannelHandle /* channel_handle */) | |
| 183 | |
| 184 // Message from GPU to notify to destroy the channel. | |
| 185 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel, int32_t /* client_id */) | |
| 186 | |
| 187 // Message to cache the given shader information. | |
| 188 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader, | |
| 189 int32_t /* client_id */, | |
| 190 std::string /* key */, | |
| 191 std::string /* shader */) | |
| 192 | |
| 193 // Message to the GPU that a shader was loaded from disk. | |
| 194 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader, std::string /* encoded shader */) | |
| 195 | |
| 196 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message. | |
| 197 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated, | |
| 198 gfx::GpuMemoryBufferHandle /* handle */) | |
| 199 | |
| 200 // Response from GPU to a GpuMsg_CollectGraphicsInfo. | |
| 201 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, | |
| 202 gpu::GPUInfo /* GPU logging stats */) | |
| 203 | |
| 204 // Response from GPU to a GpuMsg_GetVideoMemory. | |
| 205 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats, | |
| 206 content::GPUVideoMemoryUsageStats /* GPU memory stats */) | |
| 207 | |
| 208 #if defined(OS_MACOSX) | |
| 209 // Tells the browser that an accelerated surface has swapped. | |
| 210 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, | |
| 211 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) | |
| 212 #endif | |
| 213 | |
| 214 #if defined(OS_WIN) | |
| 215 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow, | |
| 216 gfx::PluginWindowHandle /* parent_window */, | |
| 217 gfx::PluginWindowHandle /* child_window */) | |
| 218 #endif | |
| 219 | |
| 220 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext, GURL /* url */) | |
| 221 | |
| 222 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext, | |
| 223 bool /* offscreen */, | |
| 224 gpu::error::ContextLostReason /* reason */, | |
| 225 GURL /* url */) | |
| 226 | |
| 227 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext, GURL /* url */) | |
| 228 | |
| 229 // Tells the browser about GPU memory usage statistics for UMA logging. | |
| 230 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats, | |
| 231 content::GPUMemoryUmaStats /* GPU memory UMA stats */) | |
| 232 | |
| 233 // Tells the browser that a context has subscribed to a new target and | |
| 234 // the browser should start sending the corresponding information | |
| 235 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription, | |
| 236 int32_t /* client_id */, | |
| 237 unsigned int /* target */) | |
| 238 | |
| 239 // Tells the browser that no contexts are subscribed to the target anymore | |
| 240 // so the browser should stop sending the corresponding information | |
| 241 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription, | |
| 242 int32_t /* client_id */, | |
| 243 unsigned int /* target */) | |
| 244 | |
| 245 // Message from GPU to add a GPU log message to the about:gpu page. | |
| 246 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage, | |
| 247 int /*severity*/, | |
| 248 std::string /* header */, | |
| 249 std::string /* message */) | |
| OLD | NEW |