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

Side by Side Diff: chrome/common/partial_circular_buffer.h

Issue 15741003: Moving WebRTC logging related files from content to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ 5 #ifndef CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_
6 #define CONTENT_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" 9 #include "base/gtest_prod_util.h"
10 #include "content/common/content_export.h"
11 10
12 namespace content { 11 namespace chrome {
13 12
14 // A wrapper around a memory buffer that allows circular read and write with a 13 // A wrapper around a memory buffer that allows circular read and write with a
15 // selectable wrapping position. Buffer layout (after wrap; H is header): 14 // selectable wrapping position. Buffer layout (after wrap; H is header):
16 // ----------------------------------------------------------- 15 // -----------------------------------------------------------
17 // | H | Beginning | End | Middle | 16 // | H | Beginning | End | Middle |
18 // ----------------------------------------------------------- 17 // -----------------------------------------------------------
19 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^ 18 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^
20 // The non-wrapping part is never overwritten. The wrapping part will be 19 // The non-wrapping part is never overwritten. The wrapping part will be
21 // circular. The very first part is the header (see the BufferData struct 20 // circular. The very first part is the header (see the BufferData struct
22 // below). It consists of the following information: 21 // below). It consists of the following information:
23 // - Length written to the buffer (not including header). 22 // - Length written to the buffer (not including header).
24 // - Wrapping position. 23 // - Wrapping position.
25 // - End position of buffer. (If the last byte is at x, this will be x + 1.) 24 // - End position of buffer. (If the last byte is at x, this will be x + 1.)
26 // Users of wrappers around the same underlying buffer must ensure that writing 25 // Users of wrappers around the same underlying buffer must ensure that writing
27 // is finished before reading is started. 26 // is finished before reading is started.
28 class CONTENT_EXPORT PartialCircularBuffer { 27 class PartialCircularBuffer {
29 public: 28 public:
30 // Use for reading. |buffer_size| is in bytes and must be larger than the 29 // Use for reading. |buffer_size| is in bytes and must be larger than the
31 // header size (see above). 30 // header size (see above).
32 PartialCircularBuffer(void* buffer, uint32 buffer_size); 31 PartialCircularBuffer(void* buffer, uint32 buffer_size);
33 32
34 // Use for writing. |buffer_size| is in bytes and must be larger than the 33 // Use for writing. |buffer_size| is in bytes and must be larger than the
35 // header size (see above). 34 // header size (see above).
36 PartialCircularBuffer(void* buffer, 35 PartialCircularBuffer(void* buffer,
37 uint32 buffer_size, 36 uint32 buffer_size,
38 uint32 wrap_position); 37 uint32 wrap_position);
(...skipping 19 matching lines...) Expand all
58 // Used for reading and writing. 57 // Used for reading and writing.
59 BufferData* buffer_data_; 58 BufferData* buffer_data_;
60 uint32 memory_buffer_size_; 59 uint32 memory_buffer_size_;
61 uint32 data_size_; 60 uint32 data_size_;
62 uint32 position_; 61 uint32 position_;
63 62
64 // Used for reading. 63 // Used for reading.
65 uint32 total_read_; 64 uint32 total_read_;
66 }; 65 };
67 66
68 } // namespace content 67 } // namespace chrome
69 68
70 #endif // CONTENT_COMMON_PARTIAL_CIRCULAR_BUFFER_H_ 69 #endif // CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698