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

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: Rebase Created 7 years, 6 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
« no previous file with comments | « chrome/common/media/webrtc_logging_messages.h ('k') | chrome/common/partial_circular_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
12 namespace content {
13 10
14 // A wrapper around a memory buffer that allows circular read and write with a 11 // 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): 12 // selectable wrapping position. Buffer layout (after wrap; H is header):
16 // ----------------------------------------------------------- 13 // -----------------------------------------------------------
17 // | H | Beginning | End | Middle | 14 // | H | Beginning | End | Middle |
18 // ----------------------------------------------------------- 15 // -----------------------------------------------------------
19 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^ 16 // ^---- Non-wrapping -----^ ^--------- Wrapping ----------^
20 // The non-wrapping part is never overwritten. The wrapping part will be 17 // 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 18 // circular. The very first part is the header (see the BufferData struct
22 // below). It consists of the following information: 19 // below). It consists of the following information:
23 // - Length written to the buffer (not including header). 20 // - Length written to the buffer (not including header).
24 // - Wrapping position. 21 // - Wrapping position.
25 // - End position of buffer. (If the last byte is at x, this will be x + 1.) 22 // - 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 23 // Users of wrappers around the same underlying buffer must ensure that writing
27 // is finished before reading is started. 24 // is finished before reading is started.
28 class CONTENT_EXPORT PartialCircularBuffer { 25 class PartialCircularBuffer {
29 public: 26 public:
30 // Use for reading. |buffer_size| is in bytes and must be larger than the 27 // Use for reading. |buffer_size| is in bytes and must be larger than the
31 // header size (see above). 28 // header size (see above).
32 PartialCircularBuffer(void* buffer, uint32 buffer_size); 29 PartialCircularBuffer(void* buffer, uint32 buffer_size);
33 30
34 // Use for writing. |buffer_size| is in bytes and must be larger than the 31 // Use for writing. |buffer_size| is in bytes and must be larger than the
35 // header size (see above). 32 // header size (see above).
36 PartialCircularBuffer(void* buffer, 33 PartialCircularBuffer(void* buffer,
37 uint32 buffer_size, 34 uint32 buffer_size,
38 uint32 wrap_position); 35 uint32 wrap_position);
(...skipping 19 matching lines...) Expand all
58 // Used for reading and writing. 55 // Used for reading and writing.
59 BufferData* buffer_data_; 56 BufferData* buffer_data_;
60 uint32 memory_buffer_size_; 57 uint32 memory_buffer_size_;
61 uint32 data_size_; 58 uint32 data_size_;
62 uint32 position_; 59 uint32 position_;
63 60
64 // Used for reading. 61 // Used for reading.
65 uint32 total_read_; 62 uint32 total_read_;
66 }; 63 };
67 64
68 } // namespace content 65 #endif // CHROME_COMMON_PARTIAL_CIRCULAR_BUFFER_H_
69
70 #endif // CONTENT_COMMON_PARTIAL_CIRCULAR_BUFFER_H_
OLDNEW
« no previous file with comments | « chrome/common/media/webrtc_logging_messages.h ('k') | chrome/common/partial_circular_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698