Chromium Code Reviews| Index: content/common/gpu/gpu_browser_messages.h |
| diff --git a/content/common/gpu/gpu_browser_messages.h b/content/common/gpu/gpu_browser_messages.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b47b5df9d29d124ef82a5652075b82ab13a78116 |
| --- /dev/null |
| +++ b/content/common/gpu/gpu_browser_messages.h |
| @@ -0,0 +1,249 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Multiply-included message file, hence no include guard here, but see below |
| +// for a much smaller-than-usual include guard section. |
| + |
| +#include "build/build_config.h" |
| +#include "content/common/content_export.h" |
| +#include "content/common/content_param_traits.h" |
| +#include "content/common/gpu/establish_channel_params.h" |
| +#include "content/common/gpu/gpu_memory_uma_stats.h" |
| +#include "content/common/gpu/gpu_process_launch_causes.h" |
| +#include "content/public/common/common_param_traits.h" |
| +#include "content/public/common/gpu_memory_stats.h" |
| +#include "gpu/command_buffer/common/sync_token.h" |
| +#include "gpu/command_buffer/common/value_state.h" |
| +#include "gpu/config/gpu_info.h" |
| +#include "ipc/ipc_channel_handle.h" |
| +#include "ipc/ipc_message_macros.h" |
| +#include "ipc/ipc_message_start.h" |
| +#include "ui/gfx/gpu_memory_buffer.h" |
| +#include "ui/gfx/ipc/gfx_param_traits.h" |
| +#include "ui/gfx/native_widget_types.h" |
| +#include "url/gurl.h" |
| + |
| +#undef IPC_MESSAGE_EXPORT |
| +#define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| + |
| +#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.
|
| + |
| +IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch, |
| + content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1) |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats) |
| + IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current) |
| + IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats) |
| + IPC_STRUCT_TRAITS_MEMBER(process_map) |
| + IPC_STRUCT_TRAITS_MEMBER(bytes_allocated) |
| + IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats) |
| + IPC_STRUCT_TRAITS_MEMBER(video_memory) |
| + IPC_STRUCT_TRAITS_MEMBER(has_duplicates) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params) |
| + IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id) |
| + IPC_STRUCT_MEMBER(gfx::Size, size) |
| + IPC_STRUCT_MEMBER(gfx::BufferFormat, format) |
| + IPC_STRUCT_MEMBER(gfx::BufferUsage, usage) |
| + IPC_STRUCT_MEMBER(int32_t, client_id) |
| + IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle) |
| +IPC_STRUCT_END() |
| + |
| +IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBufferFromHandle_Params) |
| + IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, handle) |
| + IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id) |
| + IPC_STRUCT_MEMBER(gfx::Size, size) |
| + IPC_STRUCT_MEMBER(gfx::BufferFormat, format) |
| + IPC_STRUCT_MEMBER(int32_t, client_id) |
| +IPC_STRUCT_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(content::EstablishChannelParams) |
| + IPC_STRUCT_TRAITS_MEMBER(client_id) |
| + IPC_STRUCT_TRAITS_MEMBER(client_tracing_id) |
| + IPC_STRUCT_TRAITS_MEMBER(preempts) |
| + IPC_STRUCT_TRAITS_MEMBER(allow_view_command_buffers) |
| + IPC_STRUCT_TRAITS_MEMBER(allow_real_time_streams) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +//------------------------------------------------------------------------------ |
| +// GPU Messages |
| +// These are messages from the browser to the GPU process. |
| + |
| +// Tells the GPU process to initialize itself. The browser explicitly |
| +// requests this be done so that we are guaranteed that the channel is set |
| +// up between the browser and GPU process before doing any work that might |
| +// potentially crash the GPU process. Detection of the child process |
| +// exiting abruptly is predicated on having the IPC channel set up. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) |
| + |
| +// Tells the GPU process to shutdown itself. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_Finalize) |
| + |
| +// Tells the GPU process to create a new channel for communication with a |
| +// given client. The channel name is returned in a |
| +// GpuHostMsg_ChannelEstablished message. The client ID is passed so that |
| +// the GPU process reuses an existing channel to that process if it exists. |
| +// This ID is a unique opaque identifier generated by the browser process. |
| +// The client_tracing_id is a unique ID used for the purposes of tracing. |
| +IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, |
| + content::EstablishChannelParams /* params */) |
| + |
| +// Tells the GPU process to close the channel identified by IPC channel |
| +// handle. If no channel can be identified, do nothing. |
| +IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, |
| + IPC::ChannelHandle /* channel_handle */) |
| + |
| +// Tells the GPU process to create a new gpu memory buffer. |
| +IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer, |
| + GpuMsg_CreateGpuMemoryBuffer_Params) |
| + |
| +// Tells the GPU process to create a new gpu memory buffer from an existing |
| +// handle. |
| +IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBufferFromHandle, |
| + GpuMsg_CreateGpuMemoryBufferFromHandle_Params) |
| + |
| +// Tells the GPU process to destroy buffer. |
| +IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer, |
| + gfx::GpuMemoryBufferId, /* id */ |
| + int32_t, /* client_id */ |
| + gpu::SyncToken /* sync_token */) |
| + |
| +// Tells the GPU process to create a context for collecting graphics card |
| +// information. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) |
| + |
| +// Tells the GPU process to report video_memory information for the task manager |
| +IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats) |
| + |
| +#if defined(OS_MACOSX) |
| +// Tells the GPU process that the browser process has handled the swap |
| +// buffers or post sub-buffer request. |
| +IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented, |
| + AcceleratedSurfaceMsg_BufferPresented_Params) |
| +#endif |
| + |
| +#if defined(OS_ANDROID) |
| +// Tells the GPU process to wake up the GPU because we're about to draw. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_WakeUpGpu) |
| +#endif |
| + |
| +// Tells the GPU process to remove all contexts. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_Clean) |
| + |
| +// Tells the GPU process to crash. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_Crash) |
| + |
| +// Tells the GPU process to hang. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_Hang) |
| + |
| +// Tells the GPU process to disable the watchdog thread. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog) |
| + |
| +// Tells the GPU process that the browser has seen a GPU switch. |
| +IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched) |
| + |
| +// Sends an input event to the gpu service. |
| +IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState, |
| + int, /* client_id */ |
| + unsigned int, /* target */ |
| + gpu::ValueState /* valuestate */) |
| + |
| +//------------------------------------------------------------------------------ |
| +// GPU Host Messages |
| +// These are messages to the browser. |
| + |
| +// A renderer sends this when it wants to create a connection to the GPU |
| +// process. The browser will create the GPU process if necessary, and will |
| +// return a handle to the channel via a GpuChannelEstablished message. |
| +IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel, |
| + content::CauseForGpuLaunch, |
| + int /* client id */, |
| + IPC::ChannelHandle /* handle to channel */, |
| + gpu::GPUInfo /* stats about GPU process*/) |
| + |
| +// A renderer sends this when it wants to know whether a gpu process exists. |
| +IPC_SYNC_MESSAGE_CONTROL0_1(GpuHostMsg_HasGpuProcess, bool /* result */) |
| + |
| +// Response from GPU to a GputMsg_Initialize message. |
| +IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized, |
| + bool /* result */, |
| + ::gpu::GPUInfo /* gpu_info */) |
| + |
| +// Response from GPU to a GpuHostMsg_EstablishChannel message. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished, |
| + IPC::ChannelHandle /* channel_handle */) |
| + |
| +// Message from GPU to notify to destroy the channel. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel, int32_t /* client_id */) |
| + |
| +// Message to cache the given shader information. |
| +IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader, |
| + int32_t /* client_id */, |
| + std::string /* key */, |
| + std::string /* shader */) |
| + |
| +// Message to the GPU that a shader was loaded from disk. |
| +IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader, std::string /* encoded shader */) |
| + |
| +// Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated, |
| + gfx::GpuMemoryBufferHandle /* handle */) |
| + |
| +// Response from GPU to a GpuMsg_CollectGraphicsInfo. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, |
| + gpu::GPUInfo /* GPU logging stats */) |
| + |
| +// Response from GPU to a GpuMsg_GetVideoMemory. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats, |
| + content::GPUVideoMemoryUsageStats /* GPU memory stats */) |
| + |
| +#if defined(OS_MACOSX) |
| +// Tells the browser that an accelerated surface has swapped. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, |
| + GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) |
| +#endif |
| + |
| +#if defined(OS_WIN) |
| +IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow, |
| + gfx::PluginWindowHandle /* parent_window */, |
| + gfx::PluginWindowHandle /* child_window */) |
| +#endif |
| + |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext, GURL /* url */) |
| + |
| +IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext, |
| + bool /* offscreen */, |
| + gpu::error::ContextLostReason /* reason */, |
| + GURL /* url */) |
| + |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext, GURL /* url */) |
| + |
| +// Tells the browser about GPU memory usage statistics for UMA logging. |
| +IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats, |
| + content::GPUMemoryUmaStats /* GPU memory UMA stats */) |
| + |
| +// Tells the browser that a context has subscribed to a new target and |
| +// the browser should start sending the corresponding information |
| +IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription, |
| + int32_t /* client_id */, |
| + unsigned int /* target */) |
| + |
| +// Tells the browser that no contexts are subscribed to the target anymore |
| +// so the browser should stop sending the corresponding information |
| +IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription, |
| + int32_t /* client_id */, |
| + unsigned int /* target */) |
| + |
| +// Message from GPU to add a GPU log message to the about:gpu page. |
| +IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage, |
| + int /*severity*/, |
| + std::string /* header */, |
| + std::string /* message */) |