| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ | 5 #ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ |
| 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ | 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 gpu::CommandBufferId GetCommandBufferID() const override; | 92 gpu::CommandBufferId GetCommandBufferID() const override; |
| 93 int32_t GetExtraCommandBufferData() const override; | 93 int32_t GetExtraCommandBufferData() const override; |
| 94 uint64_t GenerateFenceSyncRelease() override; | 94 uint64_t GenerateFenceSyncRelease() override; |
| 95 bool IsFenceSyncRelease(uint64_t release) override; | 95 bool IsFenceSyncRelease(uint64_t release) override; |
| 96 bool IsFenceSyncFlushed(uint64_t release) override; | 96 bool IsFenceSyncFlushed(uint64_t release) override; |
| 97 bool IsFenceSyncFlushReceived(uint64_t release) override; | 97 bool IsFenceSyncFlushReceived(uint64_t release) override; |
| 98 void SignalSyncToken(const gpu::SyncToken& sync_token, | 98 void SignalSyncToken(const gpu::SyncToken& sync_token, |
| 99 const base::Closure& callback) override; | 99 const base::Closure& callback) override; |
| 100 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 100 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
| 101 | 101 |
| 102 // CommandBufferDriver::Client implementation: | 102 private: |
| 103 // CommandBufferDriver::Client implementation. All called on GPU thread. |
| 103 void DidLoseContext(uint32_t reason) override; | 104 void DidLoseContext(uint32_t reason) override; |
| 104 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override; | 105 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override; |
| 106 void OnGpuCompletedSwapBuffers(gfx::SwapResult result) override; |
| 105 | 107 |
| 106 private: | |
| 107 ~CommandBufferLocal() override; | 108 ~CommandBufferLocal() override; |
| 108 | 109 |
| 109 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 110 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
| 110 void TryUpdateState(); | 111 void TryUpdateState(); |
| 111 void MakeProgressAndUpdateState(); | 112 void MakeProgressAndUpdateState(); |
| 112 | 113 |
| 113 // Helper functions are called in the GPU thread. | 114 // Helper functions are called in the GPU thread. |
| 114 void InitializeOnGpuThread(base::WaitableEvent* event, bool* result); | 115 void InitializeOnGpuThread(base::WaitableEvent* event, bool* result); |
| 115 bool FlushOnGpuThread(int32_t put_offset, uint32_t order_num); | 116 bool FlushOnGpuThread(int32_t put_offset, uint32_t order_num); |
| 116 bool SetGetBufferOnGpuThread(int32_t buffer); | 117 bool SetGetBufferOnGpuThread(int32_t buffer); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 127 int32_t internal_format); | 128 int32_t internal_format); |
| 128 bool DestroyImageOnGpuThread(int32_t id); | 129 bool DestroyImageOnGpuThread(int32_t id); |
| 129 bool MakeProgressOnGpuThread(base::WaitableEvent* event, | 130 bool MakeProgressOnGpuThread(base::WaitableEvent* event, |
| 130 gpu::CommandBuffer::State* state); | 131 gpu::CommandBuffer::State* state); |
| 131 bool DeleteOnGpuThread(base::WaitableEvent* event); | 132 bool DeleteOnGpuThread(base::WaitableEvent* event); |
| 132 bool SignalQueryOnGpuThread(uint32_t query_id, const base::Closure& callback); | 133 bool SignalQueryOnGpuThread(uint32_t query_id, const base::Closure& callback); |
| 133 | 134 |
| 134 // Helper functions are called in the client thread. | 135 // Helper functions are called in the client thread. |
| 135 void DidLoseContextOnClientThread(uint32_t reason); | 136 void DidLoseContextOnClientThread(uint32_t reason); |
| 136 void UpdateVSyncParametersOnClientThread(int64_t timebase, int64_t interval); | 137 void UpdateVSyncParametersOnClientThread(int64_t timebase, int64_t interval); |
| 138 void OnGpuCompletedSwapBuffersOnClientThread(gfx::SwapResult result); |
| 137 | 139 |
| 138 gfx::AcceleratedWidget widget_; | 140 gfx::AcceleratedWidget widget_; |
| 139 scoped_refptr<GpuState> gpu_state_; | 141 scoped_refptr<GpuState> gpu_state_; |
| 140 scoped_ptr<CommandBufferDriver> driver_; | 142 scoped_ptr<CommandBufferDriver> driver_; |
| 141 CommandBufferLocalClient* client_; | 143 CommandBufferLocalClient* client_; |
| 142 scoped_refptr<base::SingleThreadTaskRunner> client_thread_task_runner_; | 144 scoped_refptr<base::SingleThreadTaskRunner> client_thread_task_runner_; |
| 143 | 145 |
| 144 // Members accessed on the client thread: | 146 // Members accessed on the client thread: |
| 145 gpu::CommandBuffer::State last_state_; | 147 gpu::CommandBuffer::State last_state_; |
| 146 mojo::ScopedSharedBufferHandle shared_state_handle_; | 148 mojo::ScopedSharedBufferHandle shared_state_handle_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 160 // This weak factory will be invalidated in the client thread, so all weak | 162 // This weak factory will be invalidated in the client thread, so all weak |
| 161 // pointers have to be dereferenced in the client thread too. | 163 // pointers have to be dereferenced in the client thread too. |
| 162 base::WeakPtrFactory<CommandBufferLocal> weak_factory_; | 164 base::WeakPtrFactory<CommandBufferLocal> weak_factory_; |
| 163 | 165 |
| 164 DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal); | 166 DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal); |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 } // namespace mus | 169 } // namespace mus |
| 168 | 170 |
| 169 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ | 171 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_ |
| OLD | NEW |