| 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 12 matching lines...) Expand all Loading... |
| 23 namespace proxy { | 23 namespace proxy { |
| 24 | 24 |
| 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 gpu::CommandBufferNamespace namespace_id, |
| 35 uint64_t command_buffer_id); |
| 34 ~PpapiCommandBufferProxy() override; | 36 ~PpapiCommandBufferProxy() override; |
| 35 | 37 |
| 36 // gpu::CommandBuffer implementation: | 38 // gpu::CommandBuffer implementation: |
| 37 bool Initialize() override; | 39 bool Initialize() override; |
| 38 State GetLastState() override; | 40 State GetLastState() override; |
| 39 int32 GetLastToken() override; | 41 int32 GetLastToken() override; |
| 40 void Flush(int32 put_offset) override; | 42 void Flush(int32 put_offset) override; |
| 41 void OrderingBarrier(int32 put_offset) override; | 43 void OrderingBarrier(int32 put_offset) override; |
| 42 void WaitForTokenInRange(int32 start, int32 end) override; | 44 void WaitForTokenInRange(int32 start, int32 end) override; |
| 43 void WaitForGetOffsetInRange(int32 start, int32 end) override; | 45 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 uint32 InsertSyncPoint() override; | 62 uint32 InsertSyncPoint() override; |
| 61 uint32 InsertFutureSyncPoint() override; | 63 uint32 InsertFutureSyncPoint() override; |
| 62 void RetireSyncPoint(uint32 sync_point) override; | 64 void RetireSyncPoint(uint32 sync_point) override; |
| 63 void SignalSyncPoint(uint32 sync_point, | 65 void SignalSyncPoint(uint32 sync_point, |
| 64 const base::Closure& callback) override; | 66 const base::Closure& callback) override; |
| 65 void SignalQuery(uint32 query, const base::Closure& callback) override; | 67 void SignalQuery(uint32 query, const base::Closure& callback) override; |
| 66 void SetSurfaceVisible(bool visible) override; | 68 void SetSurfaceVisible(bool visible) override; |
| 67 uint32 CreateStreamTexture(uint32 texture_id) override; | 69 uint32 CreateStreamTexture(uint32 texture_id) override; |
| 68 void SetLock(base::Lock*) override; | 70 void SetLock(base::Lock*) override; |
| 69 bool IsGpuChannelLost() override; | 71 bool IsGpuChannelLost() override; |
| 72 gpu::CommandBufferNamespace GetNamespaceID() const override; |
| 73 uint64_t GetCommandBufferID() const override; |
| 70 | 74 |
| 71 private: | 75 private: |
| 72 bool Send(IPC::Message* msg); | 76 bool Send(IPC::Message* msg); |
| 73 void UpdateState(const gpu::CommandBuffer::State& state, bool success); | 77 void UpdateState(const gpu::CommandBuffer::State& state, bool success); |
| 74 | 78 |
| 75 // Try to read an updated copy of the state from shared memory. | 79 // Try to read an updated copy of the state from shared memory. |
| 76 void TryUpdateState(); | 80 void TryUpdateState(); |
| 77 | 81 |
| 78 // The shared memory area used to update state. | 82 // The shared memory area used to update state. |
| 79 gpu::CommandBufferSharedState* shared_state() const; | 83 gpu::CommandBufferSharedState* shared_state() const; |
| 80 | 84 |
| 81 void FlushInternal(); | 85 void FlushInternal(); |
| 82 | 86 |
| 87 const gpu::CommandBufferNamespace namespace_id_; |
| 88 const uint64_t command_buffer_id_; |
| 89 |
| 83 gpu::Capabilities capabilities_; | 90 gpu::Capabilities capabilities_; |
| 84 State last_state_; | 91 State last_state_; |
| 85 scoped_ptr<base::SharedMemory> shared_state_shm_; | 92 scoped_ptr<base::SharedMemory> shared_state_shm_; |
| 86 | 93 |
| 87 HostResource resource_; | 94 HostResource resource_; |
| 88 PluginDispatcher* dispatcher_; | 95 PluginDispatcher* dispatcher_; |
| 89 | 96 |
| 90 base::Closure channel_error_callback_; | 97 base::Closure channel_error_callback_; |
| 91 | 98 |
| 92 InstanceData::FlushInfo *flush_info_; | 99 InstanceData::FlushInfo *flush_info_; |
| 93 | 100 |
| 94 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); | 101 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); |
| 95 }; | 102 }; |
| 96 | 103 |
| 97 } // namespace proxy | 104 } // namespace proxy |
| 98 } // namespace ppapi | 105 } // namespace ppapi |
| 99 | 106 |
| 100 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ | 107 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ |
| OLD | NEW |