| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // The bool parameter will be true for SetLatch, and false for a WaitLatch | 129 // The bool parameter will be true for SetLatch, and false for a WaitLatch |
| 129 // that is blocked. An unblocked WaitLatch will not trigger a callback. | 130 // that is blocked. An unblocked WaitLatch will not trigger a callback. |
| 130 void SetLatchCallback(const base::Callback<void(bool)>& callback) { | 131 void SetLatchCallback(const base::Callback<void(bool)>& callback) { |
| 131 decoder_->SetLatchCallback(callback); | 132 decoder_->SetLatchCallback(callback); |
| 132 } | 133 } |
| 133 | 134 |
| 134 // Get the GLES2Decoder associated with this scheduler. | 135 // Get the GLES2Decoder associated with this scheduler. |
| 135 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 136 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
| 136 | 137 |
| 137 protected: | 138 protected: |
| 138 // Perform common initialization. Takes ownership of GLContext. | 139 // Perform common initialization. Takes ownership of GLSurface and GLContext. |
| 139 bool InitializeCommon( | 140 bool InitializeCommon( |
| 141 gfx::GLSurface* surface, |
| 140 gfx::GLContext* context, | 142 gfx::GLContext* context, |
| 141 const gfx::Size& size, | 143 const gfx::Size& size, |
| 142 const gles2::DisallowedExtensions& disallowed_extensions, | 144 const gles2::DisallowedExtensions& disallowed_extensions, |
| 143 const char* allowed_extensions, | 145 const char* allowed_extensions, |
| 144 const std::vector<int32>& attribs, | 146 const std::vector<int32>& attribs, |
| 145 gles2::GLES2Decoder* parent_decoder, | 147 gles2::GLES2Decoder* parent_decoder, |
| 146 uint32 parent_texture_id); | 148 uint32 parent_texture_id); |
| 147 | 149 |
| 148 | 150 |
| 149 private: | 151 private: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 177 #endif | 179 #endif |
| 178 | 180 |
| 179 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; | 181 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; |
| 180 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; | 182 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; |
| 181 scoped_ptr<Callback0::Type> command_processed_callback_; | 183 scoped_ptr<Callback0::Type> command_processed_callback_; |
| 182 }; | 184 }; |
| 183 | 185 |
| 184 } // namespace gpu | 186 } // namespace gpu |
| 185 | 187 |
| 186 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 188 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
| OLD | NEW |