| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_PGL_COMMAND_BUFFER_PEPPER_H | 5 #ifndef GPU_PGL_COMMAND_BUFFER_PEPPER_H |
| 6 #define GPU_PGL_COMMAND_BUFFER_PEPPER_H | 6 #define GPU_PGL_COMMAND_BUFFER_PEPPER_H |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "third_party/npapi/bindings/npapi.h" | 9 #include "third_party/npapi/bindings/npapi.h" |
| 10 #include "third_party/npapi/bindings/npruntime.h" | 10 #include "third_party/npapi/bindings/npruntime.h" |
| 11 #include "third_party/npapi/bindings/npapi_extensions.h" | 11 #include "third_party/npapi/bindings/npapi_extensions.h" |
| 12 #ifdef __native_client__ | 12 #ifdef __native_client__ |
| 13 #include "native_client/src/third_party/npapi/files/include/npupp.h" | 13 #include "native_client/src/third_party/npapi/files/include/npupp.h" |
| 14 #else | 14 #else |
| 15 #include "third_party/npapi/bindings/nphostapi.h" | 15 #include "third_party/npapi/bindings/nphostapi.h" |
| 16 #endif // __native_client__ | 16 #endif // __native_client__ |
| 17 | 17 |
| 18 namespace { |
| 19 class SharedMemory; |
| 20 } |
| 21 |
| 18 // A CommandBuffer proxy implementation that uses the Pepper API to access | 22 // A CommandBuffer proxy implementation that uses the Pepper API to access |
| 19 // the command buffer. | 23 // the command buffer. |
| 20 | 24 |
| 21 class CommandBufferPepper : public gpu::CommandBuffer { | 25 class CommandBufferPepper : public gpu::CommandBuffer { |
| 22 public: | 26 public: |
| 23 CommandBufferPepper(NPP npp, | 27 CommandBufferPepper(NPP npp, |
| 24 NPDevice* device, | 28 NPDevice* device, |
| 25 NPDeviceContext3D* device_context); | 29 NPDeviceContext3D* device_context); |
| 26 virtual ~CommandBufferPepper(); | 30 virtual ~CommandBufferPepper(); |
| 27 | 31 |
| 28 // CommandBuffer implementation. | 32 // CommandBuffer implementation. |
| 29 virtual bool Initialize(int32 size); | 33 virtual bool Initialize(int32 size); |
| 34 virtual bool Initialize(base::SharedMemory* buffer, int32 size); |
| 30 virtual gpu::Buffer GetRingBuffer(); | 35 virtual gpu::Buffer GetRingBuffer(); |
| 31 virtual State GetState(); | 36 virtual State GetState(); |
| 32 virtual void Flush(int32 put_offset); | 37 virtual void Flush(int32 put_offset); |
| 33 virtual State FlushSync(int32 put_offset); | 38 virtual State FlushSync(int32 put_offset); |
| 34 virtual void SetGetOffset(int32 get_offset); | 39 virtual void SetGetOffset(int32 get_offset); |
| 35 virtual int32 CreateTransferBuffer(size_t size); | 40 virtual int32 CreateTransferBuffer(size_t size); |
| 36 virtual void DestroyTransferBuffer(int32 id); | 41 virtual void DestroyTransferBuffer(int32 id); |
| 37 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 42 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
| 38 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 43 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
| 39 size_t size); | 44 size_t size); |
| 40 virtual void SetToken(int32 token); | 45 virtual void SetToken(int32 token); |
| 41 virtual void SetParseError(gpu::error::Error error); | 46 virtual void SetParseError(gpu::error::Error error); |
| 42 | 47 |
| 43 gpu::error::Error GetCachedError(); | 48 gpu::error::Error GetCachedError(); |
| 44 | 49 |
| 45 private: | 50 private: |
| 46 CommandBuffer::State ConvertState(); | 51 CommandBuffer::State ConvertState(); |
| 47 | 52 |
| 48 NPP npp_; | 53 NPP npp_; |
| 49 NPDevice* device_; | 54 NPDevice* device_; |
| 50 NPDeviceContext3D* context_; | 55 NPDeviceContext3D* context_; |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 #endif // GPU_PGL_COMMAND_BUFFER_PEPPER_H | 58 #endif // GPU_PGL_COMMAND_BUFFER_PEPPER_H |
| OLD | NEW |