Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: gpu/command_buffer/client/ring_buffer.h

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This file contains the definition of the RingBuffer class. 5 // This file contains the definition of the RingBuffer class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_
8 #define GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ 8 #define GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_
9 9
10 #include <stdint.h>
11
10 #include <deque> 12 #include <deque>
11 13
12 #include "base/logging.h" 14 #include "base/logging.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "gpu/gpu_export.h" 16 #include "gpu/gpu_export.h"
15 17
16 namespace gpu { 18 namespace gpu {
17 class CommandBufferHelper; 19 class CommandBufferHelper;
18 20
19 // RingBuffer manages a piece of memory as a ring buffer. Memory is allocated 21 // RingBuffer manages a piece of memory as a ring buffer. Memory is allocated
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 70
69 // Gets the size of the largest free block that can be allocated if the 71 // Gets the size of the largest free block that can be allocated if the
70 // caller can wait. Allocating a block of this size will succeed, but may 72 // caller can wait. Allocating a block of this size will succeed, but may
71 // block. 73 // block.
72 unsigned int GetLargestFreeOrPendingSize() { 74 unsigned int GetLargestFreeOrPendingSize() {
73 return size_; 75 return size_;
74 } 76 }
75 77
76 // Gets a pointer to a memory block given the base memory and the offset. 78 // Gets a pointer to a memory block given the base memory and the offset.
77 void* GetPointer(RingBuffer::Offset offset) const { 79 void* GetPointer(RingBuffer::Offset offset) const {
78 return static_cast<int8*>(base_) + offset; 80 return static_cast<int8_t*>(base_) + offset;
79 } 81 }
80 82
81 // Gets the offset to a memory block given the base memory and the address. 83 // Gets the offset to a memory block given the base memory and the address.
82 RingBuffer::Offset GetOffset(void* pointer) const { 84 RingBuffer::Offset GetOffset(void* pointer) const {
83 return static_cast<int8*>(pointer) - static_cast<int8*>(base_); 85 return static_cast<int8_t*>(pointer) - static_cast<int8_t*>(base_);
84 } 86 }
85 87
86 // Rounds the given size to the alignment in use. 88 // Rounds the given size to the alignment in use.
87 unsigned int RoundToAlignment(unsigned int size) { 89 unsigned int RoundToAlignment(unsigned int size) {
88 return (size + alignment_ - 1) & ~(alignment_ - 1); 90 return (size + alignment_ - 1) & ~(alignment_ - 1);
89 } 91 }
90 92
91 93
92 private: 94 private:
93 enum State { 95 enum State {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 139
138 // The physical address that corresponds to base_offset. 140 // The physical address that corresponds to base_offset.
139 void* base_; 141 void* base_;
140 142
141 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); 143 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer);
142 }; 144 };
143 145
144 } // namespace gpu 146 } // namespace gpu
145 147
146 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ 148 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/query_tracker_unittest.cc ('k') | gpu/command_buffer/client/ring_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698