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