OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class PluginDispatcher; | 24 class PluginDispatcher; |
25 class SerializedHandle; | 25 class SerializedHandle; |
26 | 26 |
27 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, | 27 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, |
28 public gpu::GpuControl { | 28 public gpu::GpuControl { |
29 public: | 29 public: |
30 PpapiCommandBufferProxy(const HostResource& resource, | 30 PpapiCommandBufferProxy(const HostResource& resource, |
31 PluginDispatcher* dispatcher, | 31 PluginDispatcher* dispatcher, |
32 const gpu::Capabilities& capabilities, | 32 const gpu::Capabilities& capabilities, |
33 const SerializedHandle& shared_state); | 33 const SerializedHandle& shared_state); |
34 virtual ~PpapiCommandBufferProxy(); | 34 ~PpapiCommandBufferProxy() override; |
35 | 35 |
36 // gpu::CommandBuffer implementation: | 36 // gpu::CommandBuffer implementation: |
37 virtual bool Initialize() override; | 37 bool Initialize() override; |
38 virtual State GetLastState() override; | 38 State GetLastState() override; |
39 virtual int32 GetLastToken() override; | 39 int32 GetLastToken() override; |
40 virtual void Flush(int32 put_offset) override; | 40 void Flush(int32 put_offset) override; |
41 virtual void OrderingBarrier(int32 put_offset) override; | 41 void OrderingBarrier(int32 put_offset) override; |
42 virtual void WaitForTokenInRange(int32 start, int32 end) override; | 42 void WaitForTokenInRange(int32 start, int32 end) override; |
43 virtual void WaitForGetOffsetInRange(int32 start, int32 end) override; | 43 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
44 virtual void SetGetBuffer(int32 transfer_buffer_id) override; | 44 void SetGetBuffer(int32 transfer_buffer_id) override; |
45 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 45 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
46 int32* id) override; | 46 int32* id) override; |
47 virtual void DestroyTransferBuffer(int32 id) override; | 47 void DestroyTransferBuffer(int32 id) override; |
48 | 48 |
49 // gpu::GpuControl implementation: | 49 // gpu::GpuControl implementation: |
50 virtual gpu::Capabilities GetCapabilities() override; | 50 gpu::Capabilities GetCapabilities() override; |
51 virtual int32 CreateImage(ClientBuffer buffer, | 51 int32 CreateImage(ClientBuffer buffer, |
52 size_t width, | 52 size_t width, |
53 size_t height, | 53 size_t height, |
54 unsigned internalformat) override; | 54 unsigned internalformat) override; |
55 virtual void DestroyImage(int32 id) override; | 55 void DestroyImage(int32 id) override; |
56 virtual int32 CreateGpuMemoryBufferImage(size_t width, | 56 int32 CreateGpuMemoryBufferImage(size_t width, |
57 size_t height, | 57 size_t height, |
58 unsigned internalformat, | 58 unsigned internalformat, |
59 unsigned usage) override; | 59 unsigned usage) override; |
60 virtual uint32 InsertSyncPoint() override; | 60 uint32 InsertSyncPoint() override; |
61 virtual uint32 InsertFutureSyncPoint() override; | 61 uint32 InsertFutureSyncPoint() override; |
62 virtual void RetireSyncPoint(uint32 sync_point) override; | 62 void RetireSyncPoint(uint32 sync_point) override; |
63 virtual void SignalSyncPoint(uint32 sync_point, | 63 void SignalSyncPoint(uint32 sync_point, |
64 const base::Closure& callback) override; | 64 const base::Closure& callback) override; |
65 virtual void SignalQuery(uint32 query, | 65 void SignalQuery(uint32 query, const base::Closure& callback) override; |
66 const base::Closure& callback) override; | 66 void SetSurfaceVisible(bool visible) override; |
67 virtual void SetSurfaceVisible(bool visible) override; | 67 uint32 CreateStreamTexture(uint32 texture_id) override; |
68 virtual uint32 CreateStreamTexture(uint32 texture_id) override; | |
69 void SetLock(base::Lock*) override; | 68 void SetLock(base::Lock*) override; |
70 | 69 |
71 private: | 70 private: |
72 bool Send(IPC::Message* msg); | 71 bool Send(IPC::Message* msg); |
73 void UpdateState(const gpu::CommandBuffer::State& state, bool success); | 72 void UpdateState(const gpu::CommandBuffer::State& state, bool success); |
74 | 73 |
75 // Try to read an updated copy of the state from shared memory. | 74 // Try to read an updated copy of the state from shared memory. |
76 void TryUpdateState(); | 75 void TryUpdateState(); |
77 | 76 |
78 // The shared memory area used to update state. | 77 // The shared memory area used to update state. |
79 gpu::CommandBufferSharedState* shared_state() const; | 78 gpu::CommandBufferSharedState* shared_state() const; |
80 | 79 |
81 gpu::Capabilities capabilities_; | 80 gpu::Capabilities capabilities_; |
82 State last_state_; | 81 State last_state_; |
83 scoped_ptr<base::SharedMemory> shared_state_shm_; | 82 scoped_ptr<base::SharedMemory> shared_state_shm_; |
84 | 83 |
85 HostResource resource_; | 84 HostResource resource_; |
86 PluginDispatcher* dispatcher_; | 85 PluginDispatcher* dispatcher_; |
87 | 86 |
88 base::Closure channel_error_callback_; | 87 base::Closure channel_error_callback_; |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); | 89 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace proxy | 92 } // namespace proxy |
94 } // namespace ppapi | 93 } // namespace ppapi |
95 | 94 |
96 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 95 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
OLD | NEW |