| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| 7 | 7 |
| 8 #include "base/task.h" | 8 #include "base/basictypes.h" |
| 9 #include "gpu/command_buffer/common/buffer.h" | 9 #include "gpu/command_buffer/common/buffer.h" |
| 10 | 10 |
| 11 namespace gpu { | 11 namespace gpu { |
| 12 | 12 |
| 13 // Common interface for CommandBuffer implementations. | 13 // Common interface for CommandBuffer implementations. |
| 14 class CommandBuffer { | 14 class CommandBuffer { |
| 15 public: | 15 public: |
| 16 CommandBuffer() { | 16 CommandBuffer() { |
| 17 } | 17 } |
| 18 | 18 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Returns the current get offset. This can be called from any thread. | 36 // Returns the current get offset. This can be called from any thread. |
| 37 virtual int32 GetGetOffset() = 0; | 37 virtual int32 GetGetOffset() = 0; |
| 38 | 38 |
| 39 // Sets the current get offset. This can be called from any thread. | 39 // Sets the current get offset. This can be called from any thread. |
| 40 virtual void SetGetOffset(int32 get_offset) = 0; | 40 virtual void SetGetOffset(int32 get_offset) = 0; |
| 41 | 41 |
| 42 // Returns the current put offset. This can be called from any thread. | 42 // Returns the current put offset. This can be called from any thread. |
| 43 virtual int32 GetPutOffset() = 0; | 43 virtual int32 GetPutOffset() = 0; |
| 44 | 44 |
| 45 // Sets a callback that should be posted on another thread whenever the put | |
| 46 // offset is changed. The callback must not return until some progress has | |
| 47 // been made (unless the command buffer is empty), i.e. the | |
| 48 // get offset must have changed. It need not process the entire command | |
| 49 // buffer though. This allows concurrency between the writer and the reader | |
| 50 // while giving the writer a means of waiting for the reader to make some | |
| 51 // progress before attempting to write more to the command buffer. Avoiding | |
| 52 // the use of a synchronization primitive like a condition variable to | |
| 53 // synchronize reader and writer reduces the risk of deadlock. | |
| 54 // Takes ownership of callback. The callback is invoked on the plugin thread. | |
| 55 virtual void SetPutOffsetChangeCallback(Callback0::Type* callback) = 0; | |
| 56 | |
| 57 // Create a transfer buffer and return a handle that uniquely | 45 // Create a transfer buffer and return a handle that uniquely |
| 58 // identifies it or -1 on error. | 46 // identifies it or -1 on error. |
| 59 virtual int32 CreateTransferBuffer(size_t size) = 0; | 47 virtual int32 CreateTransferBuffer(size_t size) = 0; |
| 60 | 48 |
| 61 // Destroy a transfer buffer and recycle the handle. | 49 // Destroy a transfer buffer and recycle the handle. |
| 62 virtual void DestroyTransferBuffer(int32 id) = 0; | 50 virtual void DestroyTransferBuffer(int32 id) = 0; |
| 63 | 51 |
| 64 // Get the transfer buffer associated with a handle. | 52 // Get the transfer buffer associated with a handle. |
| 65 virtual Buffer GetTransferBuffer(int32 handle) = 0; | 53 virtual Buffer GetTransferBuffer(int32 handle) = 0; |
| 66 | 54 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 88 // command buffer cannot recover and ceases to process commands. | 76 // command buffer cannot recover and ceases to process commands. |
| 89 virtual void RaiseErrorStatus() = 0; | 77 virtual void RaiseErrorStatus() = 0; |
| 90 | 78 |
| 91 private: | 79 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 80 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
| 93 }; | 81 }; |
| 94 | 82 |
| 95 } // namespace gpu | 83 } // namespace gpu |
| 96 | 84 |
| 97 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 85 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| OLD | NEW |