OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
15 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
16 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "gpu/command_buffer/client/gpu_control.h" |
17 #include "gpu/command_buffer/common/command_buffer.h" | 20 #include "gpu/command_buffer/common/command_buffer.h" |
18 #include "gpu/command_buffer/common/gpu_control.h" | |
19 #include "gpu/gpu_export.h" | 21 #include "gpu/gpu_export.h" |
20 #include "ui/gfx/gpu_memory_buffer.h" | 22 #include "ui/gfx/gpu_memory_buffer.h" |
21 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
22 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
23 #include "ui/gl/gpu_preference.h" | 25 #include "ui/gl/gpu_preference.h" |
24 | 26 |
25 namespace base { | 27 namespace base { |
26 class SequenceChecker; | 28 class SequenceChecker; |
27 } | 29 } |
28 | 30 |
(...skipping 14 matching lines...) Expand all Loading... |
43 #endif | 45 #endif |
44 | 46 |
45 namespace gpu { | 47 namespace gpu { |
46 | 48 |
47 namespace gles2 { | 49 namespace gles2 { |
48 class GLES2Decoder; | 50 class GLES2Decoder; |
49 class ShaderTranslatorCache; | 51 class ShaderTranslatorCache; |
50 } | 52 } |
51 | 53 |
52 class CommandBufferServiceBase; | 54 class CommandBufferServiceBase; |
| 55 class GpuControlService; |
53 class GpuMemoryBufferFactory; | 56 class GpuMemoryBufferFactory; |
54 class GpuScheduler; | 57 class GpuScheduler; |
55 class TransferBufferManagerInterface; | 58 class TransferBufferManagerInterface; |
56 | 59 |
57 // This class provides a thread-safe interface to the global GPU service (for | 60 // This class provides a thread-safe interface to the global GPU service (for |
58 // example GPU thread) when being run in single process mode. | 61 // example GPU thread) when being run in single process mode. |
59 // However, the behavior for accessing one context (i.e. one instance of this | 62 // However, the behavior for accessing one context (i.e. one instance of this |
60 // class) from different client threads is undefined. | 63 // class) from different client threads is undefined. |
61 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 64 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
62 public GpuControl { | 65 public GpuControl { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 scoped_ptr<GpuScheduler> gpu_scheduler_; | 198 scoped_ptr<GpuScheduler> gpu_scheduler_; |
196 scoped_ptr<gles2::GLES2Decoder> decoder_; | 199 scoped_ptr<gles2::GLES2Decoder> decoder_; |
197 scoped_refptr<gfx::GLContext> context_; | 200 scoped_refptr<gfx::GLContext> context_; |
198 scoped_refptr<gfx::GLSurface> surface_; | 201 scoped_refptr<gfx::GLSurface> surface_; |
199 base::Closure context_lost_callback_; | 202 base::Closure context_lost_callback_; |
200 | 203 |
201 // Members accessed on the client thread: | 204 // Members accessed on the client thread: |
202 State last_state_; | 205 State last_state_; |
203 int32 last_put_offset_; | 206 int32 last_put_offset_; |
204 gpu::Capabilities capabilities_; | 207 gpu::Capabilities capabilities_; |
| 208 typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap; |
| 209 GpuMemoryBufferMap gpu_memory_buffers_; |
205 | 210 |
206 // Accessed on both threads: | 211 // Accessed on both threads: |
207 scoped_ptr<CommandBufferServiceBase> command_buffer_; | 212 scoped_ptr<CommandBufferServiceBase> command_buffer_; |
208 base::Lock command_buffer_lock_; | 213 base::Lock command_buffer_lock_; |
209 base::WaitableEvent flush_event_; | 214 base::WaitableEvent flush_event_; |
210 scoped_refptr<Service> service_; | 215 scoped_refptr<Service> service_; |
211 State state_after_last_flush_; | 216 State state_after_last_flush_; |
212 base::Lock state_after_last_flush_lock_; | 217 base::Lock state_after_last_flush_lock_; |
213 scoped_ptr<GpuControl> gpu_control_; | 218 scoped_ptr<GpuControlService> gpu_control_; |
214 scoped_refptr<gfx::GLShareGroup> gl_share_group_; | 219 scoped_refptr<gfx::GLShareGroup> gl_share_group_; |
215 | 220 |
216 #if defined(OS_ANDROID) | 221 #if defined(OS_ANDROID) |
217 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; | 222 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; |
218 #endif | 223 #endif |
219 | 224 |
220 // Only used with explicit scheduling and the gpu thread is the same as | 225 // Only used with explicit scheduling and the gpu thread is the same as |
221 // the client thread. | 226 // the client thread. |
222 scoped_ptr<base::SequenceChecker> sequence_checker_; | 227 scoped_ptr<base::SequenceChecker> sequence_checker_; |
223 | 228 |
224 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 229 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
225 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 230 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
226 | 231 |
227 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 232 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
228 }; | 233 }; |
229 | 234 |
230 } // namespace gpu | 235 } // namespace gpu |
231 | 236 |
232 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 237 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |