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_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/common/gpu/gpu_command_buffer_stub.h" | 18 #include "content/common/gpu/gpu_command_buffer_stub.h" |
19 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
20 #include "content/common/gpu/gpu_result_codes.h" | 20 #include "content/common/gpu/gpu_result_codes.h" |
21 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" | |
21 #include "content/common/message_router.h" | 22 #include "content/common/message_router.h" |
22 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 23 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
23 #include "ipc/ipc_sync_channel.h" | 24 #include "ipc/ipc_sync_channel.h" |
24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.h" |
25 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
26 #include "ui/gl/gl_share_group.h" | 27 #include "ui/gl/gl_share_group.h" |
27 #include "ui/gl/gpu_preference.h" | 28 #include "ui/gl/gpu_preference.h" |
28 | 29 |
29 struct GPUCreateCommandBufferConfig; | 30 struct GPUCreateCommandBufferConfig; |
30 | 31 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 bool allow_future_sync_points() const { return allow_future_sync_points_; } | 163 bool allow_future_sync_points() const { return allow_future_sync_points_; } |
163 | 164 |
164 void HandleUpdateValueState(unsigned int target, | 165 void HandleUpdateValueState(unsigned int target, |
165 const gpu::ValueState& state); | 166 const gpu::ValueState& state); |
166 | 167 |
167 // Visible for testing. | 168 // Visible for testing. |
168 const gpu::ValueStateMap* pending_valuebuffer_state() const { | 169 const gpu::ValueStateMap* pending_valuebuffer_state() const { |
169 return pending_valuebuffer_state_.get(); | 170 return pending_valuebuffer_state_.get(); |
170 } | 171 } |
171 | 172 |
173 void ReleaseJpegDecoder(); | |
174 | |
172 private: | 175 private: |
173 friend class GpuChannelMessageFilter; | 176 friend class GpuChannelMessageFilter; |
174 | 177 |
175 void OnDestroy(); | 178 void OnDestroy(); |
176 | 179 |
177 bool OnControlMessageReceived(const IPC::Message& msg); | 180 bool OnControlMessageReceived(const IPC::Message& msg); |
178 | 181 |
179 void HandleMessage(); | 182 void HandleMessage(); |
180 | 183 |
181 // Message handlers. | 184 // Message handlers. |
182 void OnCreateOffscreenCommandBuffer( | 185 void OnCreateOffscreenCommandBuffer( |
183 const gfx::Size& size, | 186 const gfx::Size& size, |
184 const GPUCreateCommandBufferConfig& init_params, | 187 const GPUCreateCommandBufferConfig& init_params, |
185 int32 route_id, | 188 int32 route_id, |
186 bool* succeeded); | 189 bool* succeeded); |
187 void OnDestroyCommandBuffer(int32 route_id); | 190 void OnDestroyCommandBuffer(int32 route_id); |
191 void OnCreateJpegDecoder(int32 route_id, bool* succeeded); | |
188 | 192 |
189 // Decrement the count of unhandled IPC messages and defer preemption. | 193 // Decrement the count of unhandled IPC messages and defer preemption. |
190 void MessageProcessed(); | 194 void MessageProcessed(); |
191 | 195 |
192 // The lifetime of objects of this class is managed by a GpuChannelManager. | 196 // The lifetime of objects of this class is managed by a GpuChannelManager. |
193 // The GpuChannelManager destroy all the GpuChannels that they own when they | 197 // The GpuChannelManager destroy all the GpuChannels that they own when they |
194 // are destroyed. So a raw pointer is safe. | 198 // are destroyed. So a raw pointer is safe. |
195 GpuChannelManager* gpu_channel_manager_; | 199 GpuChannelManager* gpu_channel_manager_; |
196 | 200 |
197 scoped_ptr<IPC::SyncChannel> channel_; | 201 scoped_ptr<IPC::SyncChannel> channel_; |
(...skipping 25 matching lines...) Expand all Loading... | |
223 | 227 |
224 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 228 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
225 | 229 |
226 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; | 230 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; |
227 | 231 |
228 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 232 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
229 | 233 |
230 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 234 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
231 StubMap stubs_; | 235 StubMap stubs_; |
232 | 236 |
237 scoped_ptr<content::GpuJpegDecodeAccelerator> jpeg_decoder_; | |
wuchengli
2015/04/15 07:11:57
Need a way to support multiple jpeg decoders here.
kcwu
2015/04/23 13:00:18
Done.
ScopedPtrHashMap need to support custom dele
| |
238 | |
233 bool log_messages_; // True if we should log sent and received messages. | 239 bool log_messages_; // True if we should log sent and received messages. |
234 gpu::gles2::DisallowedFeatures disallowed_features_; | 240 gpu::gles2::DisallowedFeatures disallowed_features_; |
235 GpuWatchdog* watchdog_; | 241 GpuWatchdog* watchdog_; |
236 bool software_; | 242 bool software_; |
237 bool handle_messages_scheduled_; | 243 bool handle_messages_scheduled_; |
238 IPC::Message* currently_processing_message_; | 244 IPC::Message* currently_processing_message_; |
239 | 245 |
240 scoped_refptr<GpuChannelMessageFilter> filter_; | 246 scoped_refptr<GpuChannelMessageFilter> filter_; |
241 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 247 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
242 | 248 |
243 size_t num_stubs_descheduled_; | 249 size_t num_stubs_descheduled_; |
244 | 250 |
245 bool allow_future_sync_points_; | 251 bool allow_future_sync_points_; |
246 | 252 |
247 // Member variables should appear before the WeakPtrFactory, to ensure | 253 // Member variables should appear before the WeakPtrFactory, to ensure |
248 // that any WeakPtrs to Controller are invalidated before its members | 254 // that any WeakPtrs to Controller are invalidated before its members |
249 // variable's destructors are executed, rendering them invalid. | 255 // variable's destructors are executed, rendering them invalid. |
250 base::WeakPtrFactory<GpuChannel> weak_factory_; | 256 base::WeakPtrFactory<GpuChannel> weak_factory_; |
251 | 257 |
252 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 258 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
253 }; | 259 }; |
254 | 260 |
255 } // namespace content | 261 } // namespace content |
256 | 262 |
257 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 263 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
OLD | NEW |