OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 public: | 49 public: |
50 explicit Buffer(std::unique_ptr<BufferBacking> backing); | 50 explicit Buffer(std::unique_ptr<BufferBacking> backing); |
51 | 51 |
52 BufferBacking* backing() const { return backing_.get(); } | 52 BufferBacking* backing() const { return backing_.get(); } |
53 void* memory() const { return memory_; } | 53 void* memory() const { return memory_; } |
54 size_t size() const { return size_; } | 54 size_t size() const { return size_; } |
55 | 55 |
56 // Returns NULL if the address overflows the memory. | 56 // Returns NULL if the address overflows the memory. |
57 void* GetDataAddress(uint32_t data_offset, uint32_t data_size) const; | 57 void* GetDataAddress(uint32_t data_offset, uint32_t data_size) const; |
58 | 58 |
| 59 // Returns NULL if the address overflows the memory. |
| 60 void* GetDataAddressAndSize(uint32_t data_offset, uint32_t* data_size) const; |
| 61 |
| 62 // Returns the remaining size of the buffer after an offset |
| 63 uint32_t GetRemainingSize(uint32_t data_offset) const; |
| 64 |
59 private: | 65 private: |
60 friend class base::RefCountedThreadSafe<Buffer>; | 66 friend class base::RefCountedThreadSafe<Buffer>; |
61 ~Buffer(); | 67 ~Buffer(); |
62 | 68 |
63 std::unique_ptr<BufferBacking> backing_; | 69 std::unique_ptr<BufferBacking> backing_; |
64 void* memory_; | 70 void* memory_; |
65 size_t size_; | 71 size_t size_; |
66 | 72 |
67 DISALLOW_COPY_AND_ASSIGN(Buffer); | 73 DISALLOW_COPY_AND_ASSIGN(Buffer); |
68 }; | 74 }; |
(...skipping 13 matching lines...) Expand all Loading... |
82 } | 88 } |
83 | 89 |
84 // Generates GUID which can be used to trace buffer using an Id. | 90 // Generates GUID which can be used to trace buffer using an Id. |
85 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( | 91 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( |
86 uint64_t tracing_process_id, | 92 uint64_t tracing_process_id, |
87 int32_t buffer_id); | 93 int32_t buffer_id); |
88 | 94 |
89 } // namespace gpu | 95 } // namespace gpu |
90 | 96 |
91 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ | 97 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ |
OLD | NEW |