OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace gpu { | 34 namespace gpu { |
35 namespace gles2 { | 35 namespace gles2 { |
36 class MailboxManager; | 36 class MailboxManager; |
37 class ProgramCache; | 37 class ProgramCache; |
38 class ShaderTranslatorCache; | 38 class ShaderTranslatorCache; |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 namespace IPC { | 42 namespace IPC { |
43 struct ChannelHandle; | 43 struct ChannelHandle; |
| 44 class SyncChannel; |
| 45 class MessageFilter; |
44 } | 46 } |
45 | 47 |
46 struct GPUCreateCommandBufferConfig; | 48 struct GPUCreateCommandBufferConfig; |
47 | 49 |
48 namespace content { | 50 namespace content { |
49 class GpuChannel; | 51 class GpuChannel; |
50 class GpuMemoryBufferFactory; | 52 class GpuMemoryBufferFactory; |
51 class GpuWatchdog; | 53 class GpuWatchdog; |
52 class MessageRouter; | 54 class MessageRouter; |
53 class SyncPointManager; | 55 class SyncPointManager; |
54 | 56 |
55 // A GpuChannelManager is a thread responsible for issuing rendering commands | 57 // A GpuChannelManager is a thread responsible for issuing rendering commands |
56 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 58 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
57 // browser process to them based on the corresponding renderer ID. | 59 // browser process to them based on the corresponding renderer ID. |
58 class GpuChannelManager : public IPC::Listener, | 60 class GpuChannelManager : public IPC::Listener, |
59 public IPC::Sender { | 61 public IPC::Sender { |
60 public: | 62 public: |
61 GpuChannelManager(MessageRouter* router, | 63 GpuChannelManager(MessageRouter* router, |
62 GpuWatchdog* watchdog, | 64 GpuWatchdog* watchdog, |
63 base::MessageLoopProxy* io_message_loop, | 65 base::MessageLoopProxy* io_message_loop, |
64 base::WaitableEvent* shutdown_event); | 66 base::WaitableEvent* shutdown_event, |
| 67 IPC::SyncChannel* channel); |
65 virtual ~GpuChannelManager(); | 68 virtual ~GpuChannelManager(); |
66 | 69 |
67 // Remove the channel for a particular renderer. | 70 // Remove the channel for a particular renderer. |
68 void RemoveChannel(int client_id); | 71 void RemoveChannel(int client_id); |
69 | 72 |
70 // Listener overrides. | 73 // Listener overrides. |
71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
72 | 75 |
73 // Sender overrides. | 76 // Sender overrides. |
74 virtual bool Send(IPC::Message* msg) OVERRIDE; | 77 virtual bool Send(IPC::Message* msg) OVERRIDE; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 124 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
122 void OnVisibilityChanged( | 125 void OnVisibilityChanged( |
123 int32 render_view_id, int32 client_id, bool visible); | 126 int32 render_view_id, int32 client_id, bool visible); |
124 void OnCreateViewCommandBuffer( | 127 void OnCreateViewCommandBuffer( |
125 const gfx::GLSurfaceHandle& window, | 128 const gfx::GLSurfaceHandle& window, |
126 int32 render_view_id, | 129 int32 render_view_id, |
127 int32 client_id, | 130 int32 client_id, |
128 const GPUCreateCommandBufferConfig& init_params, | 131 const GPUCreateCommandBufferConfig& init_params, |
129 int32 route_id); | 132 int32 route_id); |
130 void OnLoadedShader(std::string shader); | 133 void OnLoadedShader(std::string shader); |
131 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, | |
132 const gfx::Size& size, | |
133 unsigned internalformat, | |
134 unsigned usage); | |
135 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, | |
136 const gfx::Size& size, | |
137 unsigned internalformat, | |
138 unsigned usage); | |
139 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle); | 134 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle); |
| 135 void DestroyGpuMemoryBufferOnIO(const gfx::GpuMemoryBufferHandle& handle); |
140 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, | 136 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, |
141 int32 sync_point); | 137 int32 sync_point); |
142 void OnDestroyGpuMemoryBufferSyncPointRetired( | 138 void OnDestroyGpuMemoryBufferSyncPointRetired( |
143 GpuMemoryBufferOperation* gpu_memory_buffer_operation); | 139 GpuMemoryBufferOperation* gpu_memory_buffer_operation); |
144 | 140 |
145 void OnLoseAllContexts(); | 141 void OnLoseAllContexts(); |
146 | 142 |
147 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 143 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
148 base::WaitableEvent* shutdown_event_; | 144 base::WaitableEvent* shutdown_event_; |
149 | 145 |
150 // Used to send and receive IPC messages from the browser process. | 146 // Used to send and receive IPC messages from the browser process. |
151 MessageRouter* const router_; | 147 MessageRouter* const router_; |
152 | 148 |
153 // These objects manage channels to individual renderer processes there is | 149 // These objects manage channels to individual renderer processes there is |
154 // one channel for each renderer process that has connected to this GPU | 150 // one channel for each renderer process that has connected to this GPU |
155 // process. | 151 // process. |
156 GpuChannelMap gpu_channels_; | 152 GpuChannelMap gpu_channels_; |
157 scoped_refptr<gfx::GLShareGroup> share_group_; | 153 scoped_refptr<gfx::GLShareGroup> share_group_; |
158 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 154 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
159 GpuMemoryManager gpu_memory_manager_; | 155 GpuMemoryManager gpu_memory_manager_; |
160 GpuEventsDispatcher gpu_devtools_events_dispatcher_; | 156 GpuEventsDispatcher gpu_devtools_events_dispatcher_; |
161 GpuWatchdog* watchdog_; | 157 GpuWatchdog* watchdog_; |
162 scoped_refptr<SyncPointManager> sync_point_manager_; | 158 scoped_refptr<SyncPointManager> sync_point_manager_; |
163 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 159 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
164 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 160 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
165 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 161 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
166 GpuMemoryBufferOperationQueue gpu_memory_buffer_operations_; | 162 GpuMemoryBufferOperationQueue gpu_memory_buffer_operations_; |
167 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 163 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
| 164 IPC::SyncChannel* channel_; |
| 165 scoped_refptr<IPC::MessageFilter> filter_; |
168 | 166 |
169 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 167 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
170 }; | 168 }; |
171 | 169 |
172 } // namespace content | 170 } // namespace content |
173 | 171 |
174 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 172 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |