| 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 "base/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 { | 11 namespace base { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 inline uint32 Min3(uint32 a, uint32 b, uint32 c) { | 15 inline uint32 Min3(uint32 a, uint32 b, uint32 c) { |
| 16 return std::min(a, std::min(b, c)); | 16 return std::min(a, std::min(b, c)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 PartialCircularBuffer::PartialCircularBuffer(void* buffer, | 21 PartialCircularBuffer::PartialCircularBuffer(void* buffer, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 void PartialCircularBuffer::DoWrite(void* dest, const void* src, uint32 num) { | 158 void PartialCircularBuffer::DoWrite(void* dest, const void* src, uint32 num) { |
| 159 memcpy(dest, src, num); | 159 memcpy(dest, src, num); |
| 160 position_ += num; | 160 position_ += num; |
| 161 buffer_data_->total_written = | 161 buffer_data_->total_written = |
| 162 std::min(buffer_data_->total_written + num, data_size_); | 162 std::min(buffer_data_->total_written + num, data_size_); |
| 163 buffer_data_->end_position = position_; | 163 buffer_data_->end_position = position_; |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace content | 166 } // namespace base |
| OLD | NEW |