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

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

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
« no previous file with comments | « gpu/command_buffer/client/ring_buffer.h ('k') | gpu/command_buffer/client/ring_buffer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 implementation of the RingBuffer class. 5 // This file contains the implementation of the RingBuffer class.
6 6
7 #include "gpu/command_buffer/client/ring_buffer.h" 7 #include "gpu/command_buffer/client/ring_buffer.h"
8 8
9 #include <stdint.h>
10
9 #include <algorithm> 11 #include <algorithm>
10 12
11 #include "base/logging.h" 13 #include "base/logging.h"
12 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 14 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
13 15
14 namespace gpu { 16 namespace gpu {
15 17
16 RingBuffer::RingBuffer(unsigned int alignment, Offset base_offset, 18 RingBuffer::RingBuffer(unsigned int alignment,
17 unsigned int size, CommandBufferHelper* helper, 19 Offset base_offset,
20 unsigned int size,
21 CommandBufferHelper* helper,
18 void* base) 22 void* base)
19 : helper_(helper), 23 : helper_(helper),
20 base_offset_(base_offset), 24 base_offset_(base_offset),
21 size_(size), 25 size_(size),
22 free_offset_(0), 26 free_offset_(0),
23 in_use_offset_(0), 27 in_use_offset_(0),
24 alignment_(alignment), 28 alignment_(alignment),
25 base_(static_cast<int8*>(base) - base_offset) { 29 base_(static_cast<int8_t*>(base) - base_offset) {}
26 }
27 30
28 RingBuffer::~RingBuffer() { 31 RingBuffer::~RingBuffer() {
29 // Free blocks pending tokens. 32 // Free blocks pending tokens.
30 while (!blocks_.empty()) { 33 while (!blocks_.empty()) {
31 FreeOldestBlock(); 34 FreeOldestBlock();
32 } 35 }
33 } 36 }
34 37
35 void RingBuffer::FreeOldestBlock() { 38 void RingBuffer::FreeOldestBlock() {
36 DCHECK(!blocks_.empty()) << "no free blocks"; 39 DCHECK(!blocks_.empty()) << "no free blocks";
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 unsigned int largest_free_size = GetLargestFreeSizeNoWaiting(); 174 unsigned int largest_free_size = GetLargestFreeSizeNoWaiting();
172 if (free_offset_ > in_use_offset_) { 175 if (free_offset_ > in_use_offset_) {
173 // It's free from free_offset_ to size_ and from 0 to in_use_offset_. 176 // It's free from free_offset_ to size_ and from 0 to in_use_offset_.
174 return size_ - free_offset_ + in_use_offset_; 177 return size_ - free_offset_ + in_use_offset_;
175 } else { 178 } else {
176 return largest_free_size; 179 return largest_free_size;
177 } 180 }
178 } 181 }
179 182
180 } // namespace gpu 183 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/ring_buffer.h ('k') | gpu/command_buffer/client/ring_buffer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698