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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "gpu/command_buffer/common/command_buffer.h" | 10 #include "gpu/command_buffer/common/command_buffer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // writer a means of waiting for the reader to make some progress before | 72 // writer a means of waiting for the reader to make some progress before |
73 // attempting to write more to the command buffer. Takes ownership of | 73 // attempting to write more to the command buffer. Takes ownership of |
74 // callback. | 74 // callback. |
75 virtual void SetPutOffsetChangeCallback(const base::Closure& callback); | 75 virtual void SetPutOffsetChangeCallback(const base::Closure& callback); |
76 // Sets a callback that is called whenever the get buffer is changed. | 76 // Sets a callback that is called whenever the get buffer is changed. |
77 virtual void SetGetBufferChangeCallback( | 77 virtual void SetGetBufferChangeCallback( |
78 const GetBufferChangedCallback& callback); | 78 const GetBufferChangedCallback& callback); |
79 virtual void SetParseErrorCallback(const base::Closure& callback); | 79 virtual void SetParseErrorCallback(const base::Closure& callback); |
80 | 80 |
81 // Setup the shared memory that shared state should be copied into. | 81 // Setup the shared memory that shared state should be copied into. |
82 bool SetSharedStateBuffer(scoped_ptr<base::SharedMemory> shared_state_shm); | 82 void SetSharedStateBuffer(scoped_ptr<BufferBacking> shared_state_buffer); |
83 | 83 |
84 // Copy the current state into the shared state transfer buffer. | 84 // Copy the current state into the shared state transfer buffer. |
85 void UpdateState(); | 85 void UpdateState(); |
86 | 86 |
87 // Register an existing shared memory object and get an ID that can be used | 87 // Registers an existing shared memory object and get an ID that can be used |
88 // to identify it in the command buffer. Callee dups the handle until | 88 // to identify it in the command buffer. |
89 // DestroyTransferBuffer is called. | 89 bool RegisterTransferBuffer(int32 id, scoped_ptr<BufferBacking> buffer); |
90 bool RegisterTransferBuffer(int32 id, | |
91 scoped_ptr<base::SharedMemory> shared_memory, | |
92 size_t size); | |
93 | 90 |
94 private: | 91 private: |
95 int32 ring_buffer_id_; | 92 int32 ring_buffer_id_; |
96 scoped_refptr<Buffer> ring_buffer_; | 93 scoped_refptr<Buffer> ring_buffer_; |
97 scoped_ptr<base::SharedMemory> shared_state_shm_; | 94 scoped_ptr<BufferBacking> shared_state_buffer_; |
98 CommandBufferSharedState* shared_state_; | 95 CommandBufferSharedState* shared_state_; |
99 int32 num_entries_; | 96 int32 num_entries_; |
100 int32 get_offset_; | 97 int32 get_offset_; |
101 int32 put_offset_; | 98 int32 put_offset_; |
102 base::Closure put_offset_change_callback_; | 99 base::Closure put_offset_change_callback_; |
103 GetBufferChangedCallback get_buffer_change_callback_; | 100 GetBufferChangedCallback get_buffer_change_callback_; |
104 base::Closure parse_error_callback_; | 101 base::Closure parse_error_callback_; |
105 TransferBufferManagerInterface* transfer_buffer_manager_; | 102 TransferBufferManagerInterface* transfer_buffer_manager_; |
106 int32 token_; | 103 int32 token_; |
107 uint32 generation_; | 104 uint32 generation_; |
108 error::Error error_; | 105 error::Error error_; |
109 error::ContextLostReason context_lost_reason_; | 106 error::ContextLostReason context_lost_reason_; |
110 | 107 |
111 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); | 108 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); |
112 }; | 109 }; |
113 | 110 |
114 } // namespace gpu | 111 } // namespace gpu |
115 | 112 |
116 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 113 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
OLD | NEW |