| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ | 5 #ifndef O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ |
| 6 #define O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ | 6 #define O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace o3d { | 25 namespace o3d { |
| 26 namespace gpu_plugin { | 26 namespace gpu_plugin { |
| 27 | 27 |
| 28 // This class processes commands in a command buffer. It is event driven and | 28 // This class processes commands in a command buffer. It is event driven and |
| 29 // posts tasks to the current message loop to do additional work. | 29 // posts tasks to the current message loop to do additional work. |
| 30 class GPUProcessor : public ::base::RefCounted<GPUProcessor>, | 30 class GPUProcessor : public ::base::RefCounted<GPUProcessor>, |
| 31 public command_buffer::CommandBufferEngine { | 31 public command_buffer::CommandBufferEngine { |
| 32 public: | 32 public: |
| 33 #if defined(CB_SERVICE_D3D9) | 33 #if defined(CB_SERVICE_D3D9) |
| 34 typedef command_buffer::GAPID3D9 GPUGAPIInterface; | 34 typedef command_buffer::o3d::GAPID3D9 GPUGAPIInterface; |
| 35 #elif defined(CB_SERVICE_GL) | 35 #elif defined(CB_SERVICE_GL) |
| 36 typedef command_buffer::GAPIGL GPUGAPIInterface; | 36 typedef command_buffer::o3d::GAPIGL GPUGAPIInterface; |
| 37 #else | 37 #else |
| 38 #error command buffer service not defined | 38 #error command buffer service not defined |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 GPUProcessor(NPP npp, | 41 GPUProcessor(NPP npp, |
| 42 CommandBuffer* command_buffer); | 42 CommandBuffer* command_buffer); |
| 43 | 43 |
| 44 // This constructor is for unit tests. | 44 // This constructor is for unit tests. |
| 45 GPUProcessor(NPP npp, | 45 GPUProcessor(NPP npp, |
| 46 CommandBuffer* command_buffer, | 46 CommandBuffer* command_buffer, |
| 47 GPUGAPIInterface* gapi, | 47 GPUGAPIInterface* gapi, |
| 48 command_buffer::GAPIDecoder* decoder, | 48 command_buffer::o3d::GAPIDecoder* decoder, |
| 49 command_buffer::CommandParser* parser, | 49 command_buffer::CommandParser* parser, |
| 50 int commands_per_update); | 50 int commands_per_update); |
| 51 | 51 |
| 52 virtual bool Initialize(HWND hwnd); | 52 virtual bool Initialize(HWND hwnd); |
| 53 | 53 |
| 54 virtual ~GPUProcessor(); | 54 virtual ~GPUProcessor(); |
| 55 | 55 |
| 56 virtual void Destroy(); | 56 virtual void Destroy(); |
| 57 | 57 |
| 58 virtual void ProcessCommands(); | 58 virtual void ProcessCommands(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 // The GPUProcessor holds a weak reference to the CommandBuffer. The | 82 // The GPUProcessor holds a weak reference to the CommandBuffer. The |
| 83 // CommandBuffer owns the GPUProcessor and holds a strong reference to it | 83 // CommandBuffer owns the GPUProcessor and holds a strong reference to it |
| 84 // through the ProcessCommands callback. | 84 // through the ProcessCommands callback. |
| 85 CommandBuffer* command_buffer_; | 85 CommandBuffer* command_buffer_; |
| 86 | 86 |
| 87 scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; | 87 scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; |
| 88 int commands_per_update_; | 88 int commands_per_update_; |
| 89 | 89 |
| 90 scoped_ptr<GPUGAPIInterface> gapi_; | 90 scoped_ptr<GPUGAPIInterface> gapi_; |
| 91 scoped_ptr<command_buffer::GAPIDecoder> decoder_; | 91 scoped_ptr<command_buffer::o3d::GAPIDecoder> decoder_; |
| 92 scoped_ptr<command_buffer::CommandParser> parser_; | 92 scoped_ptr<command_buffer::CommandParser> parser_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace gpu_plugin | 95 } // namespace gpu_plugin |
| 96 } // namespace o3d | 96 } // namespace o3d |
| 97 | 97 |
| 98 // Callbacks to the GPUProcessor hold a reference count. | 98 // Callbacks to the GPUProcessor hold a reference count. |
| 99 template <typename Method> | 99 template <typename Method> |
| 100 class CallbackStorage<o3d::gpu_plugin::GPUProcessor, Method> { | 100 class CallbackStorage<o3d::gpu_plugin::GPUProcessor, Method> { |
| 101 public: | 101 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 | 112 |
| 113 protected: | 113 protected: |
| 114 o3d::gpu_plugin::GPUProcessor* obj_; | 114 o3d::gpu_plugin::GPUProcessor* obj_; |
| 115 Method meth_; | 115 Method meth_; |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 DISALLOW_COPY_AND_ASSIGN(CallbackStorage); | 118 DISALLOW_COPY_AND_ASSIGN(CallbackStorage); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 #endif // O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ | 121 #endif // O3D_GPU_PLUGIN_GPU_PROCESSOR_H_ |
| OLD | NEW |