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 MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ | 5 #ifndef MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ |
6 #define MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ | 6 #define MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/aligned_memory.h" | 9 #include "base/memory/aligned_memory.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual MojoWaitFlags ConsumerSatisfiableFlagsNoLock() OVERRIDE; | 58 virtual MojoWaitFlags ConsumerSatisfiableFlagsNoLock() OVERRIDE; |
59 | 59 |
60 void EnsureBufferNoLock(); | 60 void EnsureBufferNoLock(); |
61 void DestroyBufferNoLock(); | 61 void DestroyBufferNoLock(); |
62 | 62 |
63 // Get the maximum (single) write/read size right now (in number of elements); | 63 // Get the maximum (single) write/read size right now (in number of elements); |
64 // result fits in a |uint32_t|. | 64 // result fits in a |uint32_t|. |
65 size_t GetMaxNumBytesToWriteNoLock(); | 65 size_t GetMaxNumBytesToWriteNoLock(); |
66 size_t GetMaxNumBytesToReadNoLock(); | 66 size_t GetMaxNumBytesToReadNoLock(); |
67 | 67 |
| 68 // Marks the given number of bytes as consumed/discarded. |num_bytes| must be |
| 69 // greater than |current_num_bytes_|. |
| 70 void MarkDataAsConsumedNoLock(size_t num_bytes); |
| 71 |
68 // The members below are protected by |DataPipe|'s |lock_|: | 72 // The members below are protected by |DataPipe|'s |lock_|: |
69 scoped_ptr_malloc<char, base::ScopedPtrAlignedFree> buffer_; | 73 scoped_ptr_malloc<char, base::ScopedPtrAlignedFree> buffer_; |
70 // Circular buffer. | 74 // Circular buffer. |
71 size_t start_index_; | 75 size_t start_index_; |
72 size_t current_num_bytes_; | 76 size_t current_num_bytes_; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(LocalDataPipe); | 78 DISALLOW_COPY_AND_ASSIGN(LocalDataPipe); |
75 }; | 79 }; |
76 | 80 |
77 } // namespace system | 81 } // namespace system |
78 } // namespace mojo | 82 } // namespace mojo |
79 | 83 |
80 #endif // MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ | 84 #endif // MOJO_SYSTEM_LOCAL_DATA_PIPE_H_ |
OLD | NEW |