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 befc5998f0e6c1be35e9ef1693d7c599219ab85f..bee5cd2056671c3d3d8a83c2b9426325114e8254 100644 |
| --- a/content/common/gpu/gpu_channel_manager.h |
| +++ b/content/common/gpu/gpu_channel_manager.h |
| @@ -12,6 +12,7 @@ |
| #include <vector> |
| #include "base/containers/scoped_ptr_hash_map.h" |
| +#include "base/id_map.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -20,12 +21,11 @@ |
| #include "content/common/content_export.h" |
| #include "content/common/content_param_traits.h" |
| #include "content/common/gpu/gpu_memory_manager.h" |
| -#include "ipc/ipc_listener.h" |
| -#include "ipc/ipc_sender.h" |
| -#include "ipc/message_router.h" |
| +#include "gpu/command_buffer/common/constants.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 +51,60 @@ 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() const { return delegate_; } |
| + |
| + 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) |
|
no sievers
2016/02/23 21:50:12
nit: Add/Remove is also only used on Mac.
Fady Samuel
2016/02/23 22:43:43
Done.
|
| + void BufferPresented(const BufferPresentedParams& params); |
| +#endif |
| gpu::gles2::ProgramCache* program_cache(); |
| gpu::gles2::ShaderTranslatorCache* shader_translator_cache(); |
| @@ -147,33 +161,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_; |
|
no sievers
2016/02/23 21:50:12
nit: mac only here too
Fady Samuel
2016/02/23 22:43:43
Done.
|
| GpuWatchdog* watchdog_; |