| 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_COMMAND_BUFFER_H_ | 5 #ifndef O3D_GPU_PLUGIN_COMMAND_BUFFER_H_ |
| 6 #define O3D_GPU_PLUGIN_COMMAND_BUFFER_H_ | 6 #define O3D_GPU_PLUGIN_COMMAND_BUFFER_H_ |
| 7 | 7 |
| 8 #include "o3d/gpu_plugin/np_utils/default_np_object.h" | 8 #include "o3d/gpu_plugin/np_utils/default_np_object.h" |
| 9 #include "o3d/gpu_plugin/np_utils/np_dispatcher.h" | 9 #include "o3d/gpu_plugin/np_utils/np_dispatcher.h" |
| 10 #include "o3d/gpu_plugin/system_services/shared_memory_public.h" |
| 10 | 11 |
| 11 namespace o3d { | 12 namespace o3d { |
| 12 namespace gpu_plugin { | 13 namespace gpu_plugin { |
| 13 | 14 |
| 14 // An NPObject that implements a shared memory command buffer and a synchronous | 15 // An NPObject that implements a shared memory command buffer and a synchronous |
| 15 // API to manage the put and get pointers. | 16 // API to manage the put and get pointers. |
| 16 class CommandBuffer : public DefaultNPObject<NPObject> { | 17 class CommandBuffer : public DefaultNPObject<NPObject> { |
| 17 public: | 18 public: |
| 18 explicit CommandBuffer(NPP npp); | 19 explicit CommandBuffer(NPP npp); |
| 19 virtual ~CommandBuffer(); | 20 virtual ~CommandBuffer(); |
| 20 | 21 |
| 21 // Create a shared memory buffer of the given size. | 22 // Create a shared memory buffer of the given size. |
| 22 virtual bool Initialize(int32 size); | 23 virtual bool Initialize(int32 size); |
| 23 | 24 |
| 24 // Gets the shared memory object for the command buffer. | 25 // Gets the shared memory object for the command buffer. |
| 25 virtual NPObjectPointer<NPObject> GetBuffer(); | 26 virtual NPObjectPointer<NPObject> GetSharedMemory(); |
| 26 | 27 |
| 27 // The client calls this to update its put offset. | 28 // The client calls this to update its put offset. |
| 28 virtual void SetPutOffset(int32 offset); | 29 virtual void SetPutOffset(int32 offset); |
| 29 | 30 |
| 30 // The client calls this to get the servers current get offset. | 31 // The client calls this to get the servers current get offset. |
| 31 virtual int32 GetGetOffset(); | 32 virtual int32 GetGetOffset(); |
| 32 | 33 |
| 33 NP_UTILS_BEGIN_DISPATCHER_CHAIN(CommandBuffer, DefaultNPObject<NPObject>) | 34 NP_UTILS_BEGIN_DISPATCHER_CHAIN(CommandBuffer, DefaultNPObject<NPObject>) |
| 34 NP_UTILS_DISPATCHER(Initialize, bool(int32)) | 35 NP_UTILS_DISPATCHER(Initialize, bool(int32)) |
| 35 NP_UTILS_DISPATCHER(SetPutOffset, void(int32)) | 36 NP_UTILS_DISPATCHER(SetPutOffset, void(int32)) |
| 36 NP_UTILS_DISPATCHER(GetGetOffset, int32()) | 37 NP_UTILS_DISPATCHER(GetGetOffset, int32()) |
| 37 NP_UTILS_DISPATCHER(GetBuffer, NPObjectPointer<NPObject>()) | 38 NP_UTILS_DISPATCHER(GetSharedMemory, NPObjectPointer<NPObject>()) |
| 38 NP_UTILS_END_DISPATCHER_CHAIN | 39 NP_UTILS_END_DISPATCHER_CHAIN |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 NPP npp_; | 42 NPP npp_; |
| 42 NPObjectPointer<NPObject> buffer_object_; | 43 NPObjectPointer<CHRSharedMemory> shared_memory_; |
| 43 NPSharedMemory* shared_memory_; | |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace gpu_plugin | 46 } // namespace gpu_plugin |
| 47 } // namespace o3d | 47 } // namespace o3d |
| 48 | 48 |
| 49 #endif // O3D_GPU_PLUGIN_COMMAND_BUFFER_H_ | 49 #endif // O3D_GPU_PLUGIN_COMMAND_BUFFER_H_ |
| OLD | NEW |