Chromium Code Reviews| Index: content/common/gpu/gpu_channel_manager.h |
| diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h |
| index dbda9b4f5ac762d1df8c2b743075f16d6e742d0a..ce360893f1eda77a0842710ac83ab573d0cad5ca 100644 |
| --- a/content/common/gpu/gpu_channel_manager.h |
| +++ b/content/common/gpu/gpu_channel_manager.h |
| @@ -20,12 +20,14 @@ |
| #include "content/common/content_export.h" |
| #include "content/common/content_param_traits.h" |
| #include "content/common/gpu/gpu_memory_manager.h" |
| +#include "gpu/command_buffer/common/constants.h" |
| #include "ipc/ipc_listener.h" |
| #include "ipc/ipc_sender.h" |
|
no sievers
2016/02/22 21:57:42
unused ipc/ includes, yay...
you need to fwd decla
Fady Samuel
2016/02/23 04:45:27
Done.
|
| #include "ipc/message_router.h" |
| #include "ui/gfx/gpu_memory_buffer.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/gl/gl_surface.h" |
| +#include "url/gurl.h" |
| namespace base { |
| class WaitableEvent; |
| @@ -51,46 +53,62 @@ class ShaderTranslatorCache; |
| namespace IPC { |
| struct ChannelHandle; |
| -class SyncChannel; |
| } |
| -struct GPUCreateCommandBufferConfig; |
| -struct GpuMsg_EstablishChannel_Params; |
| - |
| namespace content { |
| class GpuChannel; |
| +class GpuChannelManagerDelegate; |
| class GpuMemoryBufferFactory; |
| class GpuWatchdog; |
| +class ImageTransportHelper; |
| +struct EstablishChannelParams; |
| +#if defined(OS_MACOSX) |
| +struct BufferPresentedParams; |
| +#endif |
| // A GpuChannelManager is a thread responsible for issuing rendering commands |
| // managing the lifetimes of GPU channels and forwarding IPC requests from the |
| // browser process to them based on the corresponding renderer ID. |
| -class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
| - public IPC::Sender { |
| +class CONTENT_EXPORT GpuChannelManager { |
| public: |
| - GpuChannelManager(IPC::SyncChannel* channel, |
| + GpuChannelManager(GpuChannelManagerDelegate* delegate, |
| GpuWatchdog* watchdog, |
| base::SingleThreadTaskRunner* task_runner, |
| base::SingleThreadTaskRunner* io_task_runner, |
| base::WaitableEvent* shutdown_event, |
| gpu::SyncPointManager* sync_point_manager, |
| GpuMemoryBufferFactory* gpu_memory_buffer_factory); |
| - ~GpuChannelManager() override; |
| + virtual ~GpuChannelManager(); |
| + |
| + GpuChannelManagerDelegate* delegate() { return delegate_; } |
| + const GpuChannelManagerDelegate* delegate() const { return delegate_; } |
|
no sievers
2016/02/22 21:57:42
nit: why two getters? you just need one getter tha
Fady Samuel
2016/02/23 04:45:27
This is a pattern we've been using in Mus, but it'
|
| + |
| + void EstablishChannel(const EstablishChannelParams& params); |
| + void CloseChannel(const IPC::ChannelHandle& channel_handle); |
| + void PopulateShaderCache(const std::string& shader); |
| + void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| + int client_id, |
| + const gpu::SyncToken& sync_token); |
| + void UpdateValueState(int client_id, |
| + unsigned int target, |
| + const gpu::ValueState& state); |
| +#if defined(OS_ANDROID) |
| + void WakeUpGpu(); |
| +#endif |
| + void DestroyAllChannels(); |
| // Remove the channel for a particular renderer. |
| void RemoveChannel(int client_id); |
| - // Listener overrides. |
| - bool OnMessageReceived(const IPC::Message& msg) override; |
| - |
| - // Sender overrides. |
| - bool Send(IPC::Message* msg) override; |
| - |
| void LoseAllContexts(); |
| int GenerateRouteID(); |
| - void AddRoute(int32_t routing_id, IPC::Listener* listener); |
| - void RemoveRoute(int32_t routing_id); |
| + void AddImageTransportSurface(int32_t routing_id, |
| + ImageTransportHelper* image_transport_helper); |
| + void RemoveImageTransportSurface(int32_t routing_id); |
| +#if defined(OS_MACOSX) |
| + void BufferPresented(int32_t routing_id, const BufferPresentedParams& params); |
| +#endif |
| gpu::gles2::ProgramCache* program_cache(); |
| gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); |
| @@ -147,33 +165,16 @@ class CONTENT_EXPORT GpuChannelManager : public IPC::Listener, |
| base::ScopedPtrHashMap<int32_t, scoped_ptr<GpuChannel>> gpu_channels_; |
| private: |
| - // Message handlers. |
| - bool OnControlMessageReceived(const IPC::Message& msg); |
| - void OnEstablishChannel(const GpuMsg_EstablishChannel_Params& params); |
| - void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
| - void OnVisibilityChanged(int32_t render_view_id, |
| - int32_t client_id, |
| - bool visible); |
| - void OnLoadedShader(const std::string& shader); |
| - void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| - void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, int client_id); |
| - void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| - int client_id, |
| - const gpu::SyncToken& sync_token); |
| - |
| - void OnUpdateValueState(int client_id, |
| - unsigned int target, |
| - const gpu::ValueState& state); |
| + void InternalDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); |
| + void InternalDestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id, |
| + int client_id); |
| #if defined(OS_ANDROID) |
| - void OnWakeUpGpu(); |
| void ScheduleWakeUpGpu(); |
| void DoWakeUpGpu(); |
| #endif |
| - void OnLoseAllContexts(); |
| - // Used to send and receive IPC messages from the browser process. |
| - IPC::SyncChannel* const channel_; |
| - IPC::MessageRouter router_; |
| + GpuChannelManagerDelegate* const delegate_; |
| + IDMap<ImageTransportHelper> image_transport_map_; |
| GpuWatchdog* watchdog_; |