Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Unified Diff: content/common/gpu/gpu_browser_messages.h

Issue 1711533002: Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a couple of missings sends in GpuChildThread Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b3fcddee9f6a1b5191ab3a07996f0c4974826ca7
--- /dev/null
+++ b/content/common/gpu/gpu_browser_messages.h
@@ -0,0 +1,253 @@
+// 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 GpuBrowserMsgStart
+
+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(GpuBrowserMsg_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(GpuBrowserMsg_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(GpuBrowserMsg_Initialize)
+
+// Tells the GPU process to shutdown itself.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Finalize)
+
+// Tells the GPU process to create a new channel for communication with a
+// given client. The channel name is returned in a
+// GpuBrowserHostMsg_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(GpuBrowserMsg_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(GpuBrowserMsg_CloseChannel,
+ IPC::ChannelHandle /* channel_handle */)
+
+// Tells the GPU process to create a new gpu memory buffer.
+IPC_MESSAGE_CONTROL1(GpuBrowserMsg_CreateGpuMemoryBuffer,
+ GpuBrowserMsg_CreateGpuMemoryBuffer_Params)
+
+// Tells the GPU process to create a new gpu memory buffer from an existing
+// handle.
+IPC_MESSAGE_CONTROL1(GpuBrowserMsg_CreateGpuMemoryBufferFromHandle,
+ GpuBrowserMsg_CreateGpuMemoryBufferFromHandle_Params)
+
+// Tells the GPU process to destroy buffer.
+IPC_MESSAGE_CONTROL3(GpuBrowserMsg_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(GpuBrowserMsg_CollectGraphicsInfo)
+
+// Tells the GPU process to report video_memory information for the task manager
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_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(GpuBrowserMsg_WakeUpGpu)
+#endif
+
+// Tells the GPU process to remove all contexts.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Clean)
+
+// Tells the GPU process to crash.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Crash)
+
+// Tells the GPU process to hang.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Hang)
+
+// Tells the GPU process to disable the watchdog thread.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_DisableWatchdog)
+
+// Tells the GPU process that the browser has seen a GPU switch.
+IPC_MESSAGE_CONTROL0(GpuBrowserMsg_GpuSwitched)
+
+// Sends an input event to the gpu service.
+IPC_MESSAGE_CONTROL3(GpuBrowserMsg_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(GpuBrowserHostMsg_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(GpuBrowserHostMsg_HasGpuProcess, bool /* result */)
+
+// Response from GPU to a GputMsg_Initialize message.
+IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_Initialized,
+ bool /* result */,
+ ::gpu::GPUInfo /* gpu_info */)
+
+// Response from GPU to a GpuBrowserHostMsg_EstablishChannel message.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_ChannelEstablished,
+ IPC::ChannelHandle /* channel_handle */)
+
+// Message from GPU to notify to destroy the channel.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DestroyChannel, int32_t /* client_id */)
+
+// Message to cache the given shader information.
+IPC_MESSAGE_CONTROL3(GpuBrowserHostMsg_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(GpuBrowserMsg_LoadedShader,
+ std::string /* encoded shader */)
+
+// Response from GPU to a GpuBrowserMsg_CreateGpuMemoryBuffer message.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_GpuMemoryBufferCreated,
+ gfx::GpuMemoryBufferHandle /* handle */)
+
+// Response from GPU to a GpuBrowserMsg_CollectGraphicsInfo.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_GraphicsInfoCollected,
+ gpu::GPUInfo /* GPU logging stats */)
+
+// Response from GPU to a GpuBrowserMsg_GetVideoMemory.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_VideoMemoryUsageStats,
+ content::GPUVideoMemoryUsageStats /* GPU memory stats */)
+
+#if defined(OS_MACOSX)
+// Tells the browser that an accelerated surface has swapped.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_AcceleratedSurfaceBuffersSwapped,
+ GpuBrowserHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
+#endif
+
+#if defined(OS_WIN)
+IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_AcceleratedSurfaceCreatedChildWindow,
+ gfx::PluginWindowHandle /* parent_window */,
+ gfx::PluginWindowHandle /* child_window */)
+#endif
+
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DidCreateOffscreenContext,
+ GURL /* url */)
+
+IPC_MESSAGE_CONTROL3(GpuBrowserHostMsg_DidLoseContext,
+ bool /* offscreen */,
+ gpu::error::ContextLostReason /* reason */,
+ GURL /* url */)
+
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DidDestroyOffscreenContext,
+ GURL /* url */)
+
+// Tells the browser about GPU memory usage statistics for UMA logging.
+IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_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(GpuBrowserHostMsg_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(GpuBrowserHostMsg_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(GpuBrowserHostMsg_OnLogMessage,
+ int /*severity*/,
+ std::string /* header */,
+ std::string /* message */)

Powered by Google App Engine
This is Rietveld 408576698