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 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 namespace IPC { | 42 namespace IPC { |
43 struct ChannelHandle; | 43 struct ChannelHandle; |
44 } | 44 } |
45 | 45 |
46 struct GPUCreateCommandBufferConfig; | 46 struct GPUCreateCommandBufferConfig; |
47 | 47 |
48 namespace content { | 48 namespace content { |
49 class GpuChannel; | 49 class GpuChannel; |
| 50 class GpuMemoryBufferFactory; |
50 class GpuWatchdog; | 51 class GpuWatchdog; |
51 class MessageRouter; | 52 class MessageRouter; |
52 class SyncPointManager; | 53 class SyncPointManager; |
53 | 54 |
54 // A GpuChannelManager is a thread responsible for issuing rendering commands | 55 // A GpuChannelManager is a thread responsible for issuing rendering commands |
55 // managing the lifetimes of GPU channels and forwarding IPC requests from the | 56 // managing the lifetimes of GPU channels and forwarding IPC requests from the |
56 // browser process to them based on the corresponding renderer ID. | 57 // browser process to them based on the corresponding renderer ID. |
57 class GpuChannelManager : public IPC::Listener, | 58 class GpuChannelManager : public IPC::Listener, |
58 public IPC::Sender { | 59 public IPC::Sender { |
59 public: | 60 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 GpuEventsDispatcher* gpu_devtools_events_dispatcher() { | 92 GpuEventsDispatcher* gpu_devtools_events_dispatcher() { |
92 return &gpu_devtools_events_dispatcher_; | 93 return &gpu_devtools_events_dispatcher_; |
93 } | 94 } |
94 | 95 |
95 GpuChannel* LookupChannel(int32 client_id); | 96 GpuChannel* LookupChannel(int32 client_id); |
96 | 97 |
97 SyncPointManager* sync_point_manager() { return sync_point_manager_.get(); } | 98 SyncPointManager* sync_point_manager() { return sync_point_manager_.get(); } |
98 | 99 |
99 gfx::GLSurface* GetDefaultOffscreenSurface(); | 100 gfx::GLSurface* GetDefaultOffscreenSurface(); |
100 | 101 |
| 102 GpuMemoryBufferFactory* gpu_memory_buffer_factory() { |
| 103 return gpu_memory_buffer_factory_.get(); |
| 104 } |
| 105 |
101 private: | 106 private: |
102 struct ImageOperation { | 107 struct GpuMemoryBufferOperation { |
103 ImageOperation(int32 sync_point, base::Closure callback); | 108 GpuMemoryBufferOperation(int32 sync_point, base::Closure callback); |
104 ~ImageOperation(); | 109 ~GpuMemoryBufferOperation(); |
105 | 110 |
106 int32 sync_point; | 111 int32 sync_point; |
107 base::Closure callback; | 112 base::Closure callback; |
108 }; | 113 }; |
109 typedef base::ScopedPtrHashMap<int, GpuChannel> GpuChannelMap; | 114 typedef base::ScopedPtrHashMap<int, GpuChannel> GpuChannelMap; |
110 typedef std::deque<ImageOperation*> ImageOperationQueue; | 115 typedef std::deque<GpuMemoryBufferOperation*> GpuMemoryBufferOperationQueue; |
111 | 116 |
112 // Message handlers. | 117 // Message handlers. |
113 void OnEstablishChannel(int client_id, | 118 void OnEstablishChannel(int client_id, |
114 bool share_context, | 119 bool share_context, |
115 bool allow_future_sync_points); | 120 bool allow_future_sync_points); |
116 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); | 121 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); |
117 void OnVisibilityChanged( | 122 void OnVisibilityChanged( |
118 int32 render_view_id, int32 client_id, bool visible); | 123 int32 render_view_id, int32 client_id, bool visible); |
119 void OnCreateViewCommandBuffer( | 124 void OnCreateViewCommandBuffer( |
120 const gfx::GLSurfaceHandle& window, | 125 const gfx::GLSurfaceHandle& window, |
121 int32 render_view_id, | 126 int32 render_view_id, |
122 int32 client_id, | 127 int32 client_id, |
123 const GPUCreateCommandBufferConfig& init_params, | 128 const GPUCreateCommandBufferConfig& init_params, |
124 int32 route_id); | 129 int32 route_id); |
125 void CreateImage( | |
126 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); | |
127 void OnCreateImage( | |
128 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); | |
129 void DeleteImage(int32 client_id, int32 image_id); | |
130 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); | |
131 void OnDeleteImageSyncPointRetired(ImageOperation*); | |
132 void OnLoadedShader(std::string shader); | 130 void OnLoadedShader(std::string shader); |
| 131 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, |
| 132 const gfx::Size& size, |
| 133 unsigned internalformat, |
| 134 unsigned usage); |
133 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, | 135 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, |
134 const gfx::Size& size, | 136 const gfx::Size& size, |
135 unsigned internalformat, | 137 unsigned internalformat, |
136 unsigned usage); | 138 unsigned usage); |
| 139 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle); |
137 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, | 140 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, |
138 int32 sync_point); | 141 int32 sync_point); |
| 142 void OnDestroyGpuMemoryBufferSyncPointRetired( |
| 143 GpuMemoryBufferOperation* gpu_memory_buffer_operation); |
139 | 144 |
140 void OnLoseAllContexts(); | 145 void OnLoseAllContexts(); |
141 | 146 |
142 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 147 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
143 base::WaitableEvent* shutdown_event_; | 148 base::WaitableEvent* shutdown_event_; |
144 | 149 |
145 // Used to send and receive IPC messages from the browser process. | 150 // Used to send and receive IPC messages from the browser process. |
146 MessageRouter* const router_; | 151 MessageRouter* const router_; |
147 | 152 |
148 // These objects manage channels to individual renderer processes there is | 153 // These objects manage channels to individual renderer processes there is |
149 // one channel for each renderer process that has connected to this GPU | 154 // one channel for each renderer process that has connected to this GPU |
150 // process. | 155 // process. |
151 GpuChannelMap gpu_channels_; | 156 GpuChannelMap gpu_channels_; |
152 scoped_refptr<gfx::GLShareGroup> share_group_; | 157 scoped_refptr<gfx::GLShareGroup> share_group_; |
153 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 158 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
154 GpuMemoryManager gpu_memory_manager_; | 159 GpuMemoryManager gpu_memory_manager_; |
155 GpuEventsDispatcher gpu_devtools_events_dispatcher_; | 160 GpuEventsDispatcher gpu_devtools_events_dispatcher_; |
156 GpuWatchdog* watchdog_; | 161 GpuWatchdog* watchdog_; |
157 scoped_refptr<SyncPointManager> sync_point_manager_; | 162 scoped_refptr<SyncPointManager> sync_point_manager_; |
158 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 163 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
159 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 164 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
160 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; | 165 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; |
161 ImageOperationQueue image_operations_; | 166 GpuMemoryBufferOperationQueue gpu_memory_buffer_operations_; |
| 167 scoped_ptr<GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
162 | 168 |
163 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 169 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
164 }; | 170 }; |
165 | 171 |
166 } // namespace content | 172 } // namespace content |
167 | 173 |
168 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 174 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |