OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ | 5 #ifndef CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ |
6 #define CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ | 6 #define CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gtest_prod_util.h" | |
10 | 9 |
11 // A wrapper around a memory buffer that allows circular read and write with a | 10 // A wrapper around a memory buffer that allows circular read and write with a |
12 // selectable wrapping position. Buffer layout (after wrap; H is header): | 11 // selectable wrapping position. Buffer layout (after wrap; H is header): |
13 // ----------------------------------------------------------- | 12 // ----------------------------------------------------------- |
14 // | H | Beginning | End | Middle | | 13 // | H | Beginning | End | Middle | |
15 // ----------------------------------------------------------- | 14 // ----------------------------------------------------------- |
16 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^ | 15 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^ |
17 // The non-wrapping part is never overwritten. The wrapping part will be | 16 // The non-wrapping part is never overwritten. The wrapping part will be |
18 // circular. The very first part is the header (see the BufferData struct | 17 // circular. The very first part is the header (see the BufferData struct |
19 // below). It consists of the following information: | 18 // below). It consists of the following information: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 BufferData* buffer_data_; | 57 BufferData* buffer_data_; |
59 uint32 memory_buffer_size_; | 58 uint32 memory_buffer_size_; |
60 uint32 data_size_; | 59 uint32 data_size_; |
61 uint32 position_; | 60 uint32 position_; |
62 | 61 |
63 // Used for reading. | 62 // Used for reading. |
64 uint32 total_read_; | 63 uint32 total_read_; |
65 }; | 64 }; |
66 | 65 |
67 #endif // CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ | 66 #endif // CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ |
OLD | NEW |