OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GPU_SCHEDULER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.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/shared_memory.h" | 14 #include "base/shared_memory.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "gpu/command_buffer/common/command_buffer.h" | 16 #include "gpu/command_buffer/common/command_buffer.h" |
17 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 17 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
18 #include "gpu/command_buffer/service/cmd_parser.h" | 18 #include "gpu/command_buffer/service/cmd_parser.h" |
19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
20 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
22 #include "ui/gfx/surface/transport_dib.h" | 22 #include "ui/gfx/surface/transport_dib.h" |
23 | 23 |
24 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
25 #include "ui/gfx/surface/accelerated_surface_mac.h" | 25 #include "ui/gfx/surface/accelerated_surface_mac.h" |
26 #endif | 26 #endif |
27 | 27 |
28 namespace gfx { | 28 namespace gfx { |
29 class GLContext; | 29 class GLContext; |
| 30 class GLSurface; |
30 } | 31 } |
31 | 32 |
32 namespace gpu { | 33 namespace gpu { |
33 namespace gles2 { | 34 namespace gles2 { |
34 class ContextGroup; | 35 class ContextGroup; |
35 } | 36 } |
36 | 37 |
37 // This class processes commands in a command buffer. It is event driven and | 38 // This class processes commands in a command buffer. It is event driven and |
38 // posts tasks to the current message loop to do additional work. | 39 // posts tasks to the current message loop to do additional work. |
39 class GpuScheduler : public CommandBufferEngine { | 40 class GpuScheduler : public CommandBufferEngine { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // The bool parameter will be true for SetLatch, and false for a WaitLatch | 130 // The bool parameter will be true for SetLatch, and false for a WaitLatch |
130 // that is blocked. An unblocked WaitLatch will not trigger a callback. | 131 // that is blocked. An unblocked WaitLatch will not trigger a callback. |
131 void SetLatchCallback(const base::Callback<void(bool)>& callback) { | 132 void SetLatchCallback(const base::Callback<void(bool)>& callback) { |
132 decoder_->SetLatchCallback(callback); | 133 decoder_->SetLatchCallback(callback); |
133 } | 134 } |
134 | 135 |
135 // Get the GLES2Decoder associated with this scheduler. | 136 // Get the GLES2Decoder associated with this scheduler. |
136 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 137 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
137 | 138 |
138 protected: | 139 protected: |
139 // Perform common initialization. Takes ownership of GLContext. | 140 // Perform common initialization. Takes ownership of GLSurface and GLContext. |
140 bool InitializeCommon( | 141 bool InitializeCommon( |
| 142 gfx::GLSurface* surface, |
141 gfx::GLContext* context, | 143 gfx::GLContext* context, |
142 const gfx::Size& size, | 144 const gfx::Size& size, |
143 const gles2::DisallowedExtensions& disallowed_extensions, | 145 const gles2::DisallowedExtensions& disallowed_extensions, |
144 const char* allowed_extensions, | 146 const char* allowed_extensions, |
145 const std::vector<int32>& attribs, | 147 const std::vector<int32>& attribs, |
146 gles2::GLES2Decoder* parent_decoder, | 148 gles2::GLES2Decoder* parent_decoder, |
147 uint32 parent_texture_id); | 149 uint32 parent_texture_id); |
148 | 150 |
149 | 151 |
150 private: | 152 private: |
(...skipping 27 matching lines...) Expand all Loading... |
178 #endif | 180 #endif |
179 | 181 |
180 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; | 182 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; |
181 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; | 183 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; |
182 scoped_ptr<Callback0::Type> command_processed_callback_; | 184 scoped_ptr<Callback0::Type> command_processed_callback_; |
183 }; | 185 }; |
184 | 186 |
185 } // namespace gpu | 187 } // namespace gpu |
186 | 188 |
187 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 189 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
OLD | NEW |