OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/common/partial_circular_buffer.h" | 5 #include "chrome/common/partial_circular_buffer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 namespace content { | |
12 | |
13 namespace { | 11 namespace { |
14 | 12 |
15 inline uint32 Min3(uint32 a, uint32 b, uint32 c) { | 13 inline uint32 Min3(uint32 a, uint32 b, uint32 c) { |
16 return std::min(a, std::min(b, c)); | 14 return std::min(a, std::min(b, c)); |
17 } | 15 } |
18 | 16 |
19 } // namespace | 17 } // namespace |
20 | 18 |
21 PartialCircularBuffer::PartialCircularBuffer(void* buffer, | 19 PartialCircularBuffer::PartialCircularBuffer(void* buffer, |
22 uint32 buffer_size) | 20 uint32 buffer_size) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 153 } |
156 } | 154 } |
157 | 155 |
158 void PartialCircularBuffer::DoWrite(void* dest, const void* src, uint32 num) { | 156 void PartialCircularBuffer::DoWrite(void* dest, const void* src, uint32 num) { |
159 memcpy(dest, src, num); | 157 memcpy(dest, src, num); |
160 position_ += num; | 158 position_ += num; |
161 buffer_data_->total_written = | 159 buffer_data_->total_written = |
162 std::min(buffer_data_->total_written + num, data_size_); | 160 std::min(buffer_data_->total_written + num, data_size_); |
163 buffer_data_->end_position = position_; | 161 buffer_data_->end_position = position_; |
164 } | 162 } |
165 | |
166 } // namespace content | |
OLD | NEW |