Chromium Code Reviews| 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 GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
|
no sievers
2016/04/05 19:02:40
#include <memory>
Mostyn Bramley-Moore
2016/04/05 21:35:31
Done.
| |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "gpu/command_buffer/common/command_buffer.h" | 13 #include "gpu/command_buffer/common/command_buffer.h" |
| 14 #include "gpu/command_buffer/common/command_buffer_shared.h" | 14 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 15 | 15 |
| 16 namespace gpu { | 16 namespace gpu { |
| 17 | 17 |
| 18 class TransferBufferManagerInterface; | 18 class TransferBufferManagerInterface; |
| 19 | 19 |
| 20 class GPU_EXPORT CommandBufferServiceBase : public CommandBuffer { | 20 class GPU_EXPORT CommandBufferServiceBase : public CommandBuffer { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 // writer a means of waiting for the reader to make some progress before | 78 // writer a means of waiting for the reader to make some progress before |
| 79 // attempting to write more to the command buffer. Takes ownership of | 79 // attempting to write more to the command buffer. Takes ownership of |
| 80 // callback. | 80 // callback. |
| 81 virtual void SetPutOffsetChangeCallback(const base::Closure& callback); | 81 virtual void SetPutOffsetChangeCallback(const base::Closure& callback); |
| 82 // Sets a callback that is called whenever the get buffer is changed. | 82 // Sets a callback that is called whenever the get buffer is changed. |
| 83 virtual void SetGetBufferChangeCallback( | 83 virtual void SetGetBufferChangeCallback( |
| 84 const GetBufferChangedCallback& callback); | 84 const GetBufferChangedCallback& callback); |
| 85 virtual void SetParseErrorCallback(const base::Closure& callback); | 85 virtual void SetParseErrorCallback(const base::Closure& callback); |
| 86 | 86 |
| 87 // Setup the shared memory that shared state should be copied into. | 87 // Setup the shared memory that shared state should be copied into. |
| 88 void SetSharedStateBuffer(scoped_ptr<BufferBacking> shared_state_buffer); | 88 void SetSharedStateBuffer(std::unique_ptr<BufferBacking> shared_state_buffer); |
| 89 | 89 |
| 90 // Copy the current state into the shared state transfer buffer. | 90 // Copy the current state into the shared state transfer buffer. |
| 91 void UpdateState(); | 91 void UpdateState(); |
| 92 | 92 |
| 93 // Registers an existing shared memory object and get an ID that can be used | 93 // Registers an existing shared memory object and get an ID that can be used |
| 94 // to identify it in the command buffer. | 94 // to identify it in the command buffer. |
| 95 bool RegisterTransferBuffer(int32_t id, scoped_ptr<BufferBacking> buffer); | 95 bool RegisterTransferBuffer(int32_t id, |
| 96 std::unique_ptr<BufferBacking> buffer); | |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 int32_t ring_buffer_id_; | 99 int32_t ring_buffer_id_; |
| 99 scoped_refptr<Buffer> ring_buffer_; | 100 scoped_refptr<Buffer> ring_buffer_; |
| 100 scoped_ptr<BufferBacking> shared_state_buffer_; | 101 std::unique_ptr<BufferBacking> shared_state_buffer_; |
| 101 CommandBufferSharedState* shared_state_; | 102 CommandBufferSharedState* shared_state_; |
| 102 int32_t num_entries_; | 103 int32_t num_entries_; |
| 103 int32_t get_offset_; | 104 int32_t get_offset_; |
| 104 int32_t put_offset_; | 105 int32_t put_offset_; |
| 105 base::Closure put_offset_change_callback_; | 106 base::Closure put_offset_change_callback_; |
| 106 GetBufferChangedCallback get_buffer_change_callback_; | 107 GetBufferChangedCallback get_buffer_change_callback_; |
| 107 base::Closure parse_error_callback_; | 108 base::Closure parse_error_callback_; |
| 108 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 109 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 109 int32_t token_; | 110 int32_t token_; |
| 110 uint32_t generation_; | 111 uint32_t generation_; |
| 111 error::Error error_; | 112 error::Error error_; |
| 112 error::ContextLostReason context_lost_reason_; | 113 error::ContextLostReason context_lost_reason_; |
| 113 | 114 |
| 114 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); | 115 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace gpu | 118 } // namespace gpu |
| 118 | 119 |
| 119 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 120 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| OLD | NEW |