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_EDK_SYSTEM_DATA_PIPE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool ProducerIsBusy() const; | 66 bool ProducerIsBusy() const; |
67 | 67 |
68 // These are called by the consumer dispatcher to implement its methods of | 68 // These are called by the consumer dispatcher to implement its methods of |
69 // corresponding names. | 69 // corresponding names. |
70 void ConsumerCancelAllWaiters(); | 70 void ConsumerCancelAllWaiters(); |
71 void ConsumerClose(); | 71 void ConsumerClose(); |
72 // This does not validate its arguments, except to check that |*num_bytes| is | 72 // This does not validate its arguments, except to check that |*num_bytes| is |
73 // a multiple of |element_num_bytes_|. | 73 // a multiple of |element_num_bytes_|. |
74 MojoResult ConsumerReadData(UserPointer<void> elements, | 74 MojoResult ConsumerReadData(UserPointer<void> elements, |
75 UserPointer<uint32_t> num_bytes, | 75 UserPointer<uint32_t> num_bytes, |
76 bool all_or_none); | 76 bool all_or_none, |
| 77 bool peek); |
77 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes, | 78 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes, |
78 bool all_or_none); | 79 bool all_or_none); |
79 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes); | 80 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes); |
80 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer, | 81 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer, |
81 UserPointer<uint32_t> buffer_num_bytes, | 82 UserPointer<uint32_t> buffer_num_bytes, |
82 bool all_or_none); | 83 bool all_or_none); |
83 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); | 84 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); |
84 HandleSignalsState ConsumerGetHandleSignalsState(); | 85 HandleSignalsState ConsumerGetHandleSignalsState(); |
85 MojoResult ConsumerAddWaiter(Waiter* waiter, | 86 MojoResult ConsumerAddWaiter(Waiter* waiter, |
86 MojoHandleSignals signals, | 87 MojoHandleSignals signals, |
(...skipping 26 matching lines...) Expand all Loading... |
113 // Note: A producer should not be writable during a two-phase write. | 114 // Note: A producer should not be writable during a two-phase write. |
114 virtual HandleSignalsState ProducerGetHandleSignalsStateImplNoLock() | 115 virtual HandleSignalsState ProducerGetHandleSignalsStateImplNoLock() |
115 const = 0; | 116 const = 0; |
116 | 117 |
117 virtual void ConsumerCloseImplNoLock() = 0; | 118 virtual void ConsumerCloseImplNoLock() = 0; |
118 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. | 119 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. |
119 virtual MojoResult ConsumerReadDataImplNoLock( | 120 virtual MojoResult ConsumerReadDataImplNoLock( |
120 UserPointer<void> elements, | 121 UserPointer<void> elements, |
121 UserPointer<uint32_t> num_bytes, | 122 UserPointer<uint32_t> num_bytes, |
122 uint32_t max_num_bytes_to_read, | 123 uint32_t max_num_bytes_to_read, |
123 uint32_t min_num_bytes_to_read) = 0; | 124 uint32_t min_num_bytes_to_read, |
| 125 bool peek) = 0; |
124 virtual MojoResult ConsumerDiscardDataImplNoLock( | 126 virtual MojoResult ConsumerDiscardDataImplNoLock( |
125 UserPointer<uint32_t> num_bytes, | 127 UserPointer<uint32_t> num_bytes, |
126 uint32_t max_num_bytes_to_discard, | 128 uint32_t max_num_bytes_to_discard, |
127 uint32_t min_num_bytes_to_discard) = 0; | 129 uint32_t min_num_bytes_to_discard) = 0; |
128 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. | 130 // |*num_bytes| will be a nonzero multiple of |element_num_bytes_|. |
129 virtual MojoResult ConsumerQueryDataImplNoLock( | 131 virtual MojoResult ConsumerQueryDataImplNoLock( |
130 UserPointer<uint32_t> num_bytes) = 0; | 132 UserPointer<uint32_t> num_bytes) = 0; |
131 virtual MojoResult ConsumerBeginReadDataImplNoLock( | 133 virtual MojoResult ConsumerBeginReadDataImplNoLock( |
132 UserPointer<const void*> buffer, | 134 UserPointer<const void*> buffer, |
133 UserPointer<uint32_t> buffer_num_bytes, | 135 UserPointer<uint32_t> buffer_num_bytes, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 uint32_t producer_two_phase_max_num_bytes_written_; | 209 uint32_t producer_two_phase_max_num_bytes_written_; |
208 uint32_t consumer_two_phase_max_num_bytes_read_; | 210 uint32_t consumer_two_phase_max_num_bytes_read_; |
209 | 211 |
210 DISALLOW_COPY_AND_ASSIGN(DataPipe); | 212 DISALLOW_COPY_AND_ASSIGN(DataPipe); |
211 }; | 213 }; |
212 | 214 |
213 } // namespace system | 215 } // namespace system |
214 } // namespace mojo | 216 } // namespace mojo |
215 | 217 |
216 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 218 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |