OLD | NEW |
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 "../client/ring_buffer.h" | 7 #include "gpu/command_buffer/client/ring_buffer.h" |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include "../client/cmd_buffer_helper.h" | 9 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
10 | 10 |
11 namespace gpu { | 11 namespace gpu { |
12 | 12 |
13 RingBuffer::RingBuffer( | 13 RingBuffer::RingBuffer( |
14 Offset base_offset, unsigned int size, CommandBufferHelper* helper) | 14 Offset base_offset, unsigned int size, CommandBufferHelper* helper) |
15 : helper_(helper), | 15 : helper_(helper), |
16 base_offset_(base_offset), | 16 base_offset_(base_offset), |
17 size_(size), | 17 size_(size), |
18 free_offset_(0), | 18 free_offset_(0), |
19 in_use_offset_(0) { | 19 in_use_offset_(0) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } else if (free_offset_ > in_use_offset_) { | 108 } else if (free_offset_ > in_use_offset_) { |
109 // It's free from free_offset_ to size_ and from 0 to in_use_offset_ | 109 // It's free from free_offset_ to size_ and from 0 to in_use_offset_ |
110 return std::max(size_ - free_offset_, in_use_offset_); | 110 return std::max(size_ - free_offset_, in_use_offset_); |
111 } else { | 111 } else { |
112 // It's free from free_offset_ -> in_use_offset_; | 112 // It's free from free_offset_ -> in_use_offset_; |
113 return in_use_offset_ - free_offset_; | 113 return in_use_offset_ - free_offset_; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 } // namespace gpu | 117 } // namespace gpu |
OLD | NEW |