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> |
| 9 #include <stdint.h> |
| 10 |
8 #include "base/macros.h" | 11 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/shared_memory.h" | 14 #include "base/memory/shared_memory.h" |
12 #include "base/trace_event/memory_allocator_dump.h" | 15 #include "base/trace_event/memory_allocator_dump.h" |
13 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
14 | 17 |
15 namespace base { | 18 namespace base { |
16 class SharedMemory; | 19 class SharedMemory; |
17 } | 20 } |
(...skipping 25 matching lines...) Expand all Loading... |
43 // Buffer owns a piece of shared-memory of a certain size. | 46 // Buffer owns a piece of shared-memory of a certain size. |
44 class GPU_EXPORT Buffer : public base::RefCountedThreadSafe<Buffer> { | 47 class GPU_EXPORT Buffer : public base::RefCountedThreadSafe<Buffer> { |
45 public: | 48 public: |
46 explicit Buffer(scoped_ptr<BufferBacking> backing); | 49 explicit Buffer(scoped_ptr<BufferBacking> backing); |
47 | 50 |
48 BufferBacking* backing() const { return backing_.get(); } | 51 BufferBacking* backing() const { return backing_.get(); } |
49 void* memory() const { return memory_; } | 52 void* memory() const { return memory_; } |
50 size_t size() const { return size_; } | 53 size_t size() const { return size_; } |
51 | 54 |
52 // Returns NULL if the address overflows the memory. | 55 // Returns NULL if the address overflows the memory. |
53 void* GetDataAddress(uint32 data_offset, uint32 data_size) const; | 56 void* GetDataAddress(uint32_t data_offset, uint32_t data_size) const; |
54 | 57 |
55 private: | 58 private: |
56 friend class base::RefCountedThreadSafe<Buffer>; | 59 friend class base::RefCountedThreadSafe<Buffer>; |
57 ~Buffer(); | 60 ~Buffer(); |
58 | 61 |
59 scoped_ptr<BufferBacking> backing_; | 62 scoped_ptr<BufferBacking> backing_; |
60 void* memory_; | 63 void* memory_; |
61 size_t size_; | 64 size_t size_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(Buffer); | 66 DISALLOW_COPY_AND_ASSIGN(Buffer); |
(...skipping 14 matching lines...) Expand all Loading... |
78 } | 81 } |
79 | 82 |
80 // Generates GUID which can be used to trace buffer using an Id. | 83 // Generates GUID which can be used to trace buffer using an Id. |
81 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( | 84 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( |
82 uint64_t tracing_process_id, | 85 uint64_t tracing_process_id, |
83 int32_t buffer_id); | 86 int32_t buffer_id); |
84 | 87 |
85 } // namespace gpu | 88 } // namespace gpu |
86 | 89 |
87 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ | 90 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ |
OLD | NEW |