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_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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/linked_ptr.h" | 11 #include "base/linked_ptr.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
16 | 16 |
17 namespace gpu { | 17 namespace gpu { |
18 | 18 |
19 // An object that implements a shared memory command buffer and a synchronous | 19 // An object that implements a shared memory command buffer and a synchronous |
20 // API to manage the put and get pointers. | 20 // API to manage the put and get pointers. |
21 class CommandBufferService : public CommandBuffer { | 21 class CommandBufferService : public CommandBuffer { |
22 public: | 22 public: |
23 CommandBufferService(); | 23 CommandBufferService(); |
24 virtual ~CommandBufferService(); | 24 virtual ~CommandBufferService(); |
25 | 25 |
26 // CommandBuffer implementation: | 26 // CommandBuffer implementation: |
27 virtual base::SharedMemory* Initialize(int32 size); | 27 virtual bool Initialize(int32 size); |
28 virtual base::SharedMemory* GetRingBuffer(); | 28 virtual Buffer GetRingBuffer(); |
29 virtual int32 GetSize(); | 29 virtual int32 GetSize(); |
30 virtual int32 SyncOffsets(int32 put_offset); | 30 virtual int32 SyncOffsets(int32 put_offset); |
31 virtual int32 GetGetOffset(); | 31 virtual int32 GetGetOffset(); |
32 virtual void SetGetOffset(int32 get_offset); | 32 virtual void SetGetOffset(int32 get_offset); |
33 virtual int32 GetPutOffset(); | 33 virtual int32 GetPutOffset(); |
34 virtual void SetPutOffsetChangeCallback(Callback0::Type* callback); | 34 virtual void SetPutOffsetChangeCallback(Callback0::Type* callback); |
35 virtual int32 CreateTransferBuffer(size_t size); | 35 virtual int32 CreateTransferBuffer(size_t size); |
36 virtual void DestroyTransferBuffer(int32 id); | 36 virtual void DestroyTransferBuffer(int32 id); |
37 virtual base::SharedMemory* GetTransferBuffer(int32 handle); | 37 virtual Buffer GetTransferBuffer(int32 handle); |
38 virtual int32 GetToken(); | 38 virtual int32 GetToken(); |
39 virtual void SetToken(int32 token); | 39 virtual void SetToken(int32 token); |
40 virtual int32 ResetParseError(); | 40 virtual int32 ResetParseError(); |
41 virtual void SetParseError(int32 parse_error); | 41 virtual void SetParseError(int32 parse_error); |
42 virtual bool GetErrorStatus(); | 42 virtual bool GetErrorStatus(); |
43 virtual void RaiseErrorStatus(); | 43 virtual void RaiseErrorStatus(); |
44 | 44 |
45 private: | 45 private: |
46 scoped_ptr< base::SharedMemory> ring_buffer_; | 46 scoped_ptr< base::SharedMemory> ring_buffer_; |
47 int32 size_; | 47 int32 size_; |
48 int32 get_offset_; | 48 int32 get_offset_; |
49 int32 put_offset_; | 49 int32 put_offset_; |
50 scoped_ptr<Callback0::Type> put_offset_change_callback_; | 50 scoped_ptr<Callback0::Type> put_offset_change_callback_; |
51 std::vector<linked_ptr< base::SharedMemory> > registered_objects_; | 51 std::vector<linked_ptr< base::SharedMemory> > registered_objects_; |
52 std::set<int32> unused_registered_object_elements_; | 52 std::set<int32> unused_registered_object_elements_; |
53 int32 token_; | 53 int32 token_; |
54 int32 parse_error_; | 54 int32 parse_error_; |
55 bool error_status_; | 55 bool error_status_; |
56 }; | 56 }; |
57 | 57 |
58 } // namespace gpu | 58 } // namespace gpu |
59 | 59 |
60 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 60 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
OLD | NEW |