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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.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/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "gpu/command_buffer/common/command_buffer.h" | 16 #include "gpu/command_buffer/common/command_buffer.h" |
17 #include "gpu/gpu_export.h" | 17 #include "gpu/gpu_export.h" |
18 #include "ui/gfx/gpu_memory_buffer.h" | 18 #include "ui/gfx/gpu_memory_buffer.h" |
19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 #include "ui/gl/gl_surface.h" |
20 #include "ui/gl/gpu_preference.h" | 21 #include "ui/gl/gpu_preference.h" |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class GLContext; | 24 class GLContext; |
24 class GLImage; | 25 class GLImage; |
25 class GLSurface; | 26 class GLSurface; |
26 class Size; | 27 class Size; |
27 } | 28 } |
28 | 29 |
29 namespace gpu { | 30 namespace gpu { |
(...skipping 20 matching lines...) Expand all Loading... |
50 // The callback will be called from different client threads. After the | 51 // The callback will be called from different client threads. After the |
51 // callback is issued, the client is expected to eventually call | 52 // callback is issued, the client is expected to eventually call |
52 // ProcessGpuWorkOnCurrentThread(). The latter cannot be called from different | 53 // ProcessGpuWorkOnCurrentThread(). The latter cannot be called from different |
53 // threads. | 54 // threads. |
54 // The callback needs to be set before any context is created. | 55 // The callback needs to be set before any context is created. |
55 static void SetScheduleCallback(const base::Closure& callback); | 56 static void SetScheduleCallback(const base::Closure& callback); |
56 static void ProcessGpuWorkOnCurrentThread(); | 57 static void ProcessGpuWorkOnCurrentThread(); |
57 | 58 |
58 static void EnableVirtualizedContext(); | 59 static void EnableVirtualizedContext(); |
59 | 60 |
60 bool Initialize(bool is_offscreen, | 61 // If |surface| is not NULL, use it directly. Otherwise create a new |
| 62 // GLSurface. |
| 63 bool Initialize(scoped_refptr<gfx::GLSurface> surface, |
| 64 bool is_offscreen, |
61 bool share_resources, | 65 bool share_resources, |
62 gfx::AcceleratedWidget window, | 66 gfx::AcceleratedWidget window, |
63 const gfx::Size& size, | 67 const gfx::Size& size, |
64 const char* allowed_extensions, | 68 const char* allowed_extensions, |
65 const std::vector<int32>& attribs, | 69 const std::vector<int32>& attribs, |
66 gfx::GpuPreference gpu_preference, | 70 gfx::GpuPreference gpu_preference, |
67 const base::Closure& context_lost_callback, | 71 const base::Closure& context_lost_callback, |
68 unsigned int share_group_id); | 72 unsigned int share_group_id); |
69 void Destroy(); | 73 void Destroy(); |
70 void SignalSyncPoint(unsigned sync_point, | 74 void SignalSyncPoint(unsigned sync_point, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 base::Lock command_buffer_lock_; | 150 base::Lock command_buffer_lock_; |
147 base::WaitableEvent flush_event_; | 151 base::WaitableEvent flush_event_; |
148 scoped_ptr<SchedulerClient> queue_; | 152 scoped_ptr<SchedulerClient> queue_; |
149 | 153 |
150 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 154 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
151 }; | 155 }; |
152 | 156 |
153 } // namespace gpu | 157 } // namespace gpu |
154 | 158 |
155 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 159 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |