| 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_DATA_PIPE_H_ | 5 #ifndef MOJO_SYSTEM_DATA_PIPE_H_ |
| 6 #define MOJO_SYSTEM_DATA_PIPE_H_ | 6 #define MOJO_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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // a multiple of |element_num_bytes_|. | 53 // a multiple of |element_num_bytes_|. |
| 54 MojoResult ProducerWriteData(const void* elements, | 54 MojoResult ProducerWriteData(const void* elements, |
| 55 uint32_t* num_bytes, | 55 uint32_t* num_bytes, |
| 56 bool all_or_none); | 56 bool all_or_none); |
| 57 // This does not validate its arguments. | 57 // This does not validate its arguments. |
| 58 MojoResult ProducerBeginWriteData(void** buffer, | 58 MojoResult ProducerBeginWriteData(void** buffer, |
| 59 uint32_t* buffer_num_bytes, | 59 uint32_t* buffer_num_bytes, |
| 60 bool all_or_none); | 60 bool all_or_none); |
| 61 MojoResult ProducerEndWriteData(uint32_t num_bytes_written); | 61 MojoResult ProducerEndWriteData(uint32_t num_bytes_written); |
| 62 MojoResult ProducerAddWaiter(Waiter* waiter, | 62 MojoResult ProducerAddWaiter(Waiter* waiter, |
| 63 MojoWaitFlags flags, | 63 MojoHandleSignals signals, |
| 64 uint32_t context); | 64 uint32_t context); |
| 65 void ProducerRemoveWaiter(Waiter* waiter); | 65 void ProducerRemoveWaiter(Waiter* waiter); |
| 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(void* elements, | 74 MojoResult ConsumerReadData(void* elements, |
| 75 uint32_t* num_bytes, | 75 uint32_t* num_bytes, |
| 76 bool all_or_none); | 76 bool all_or_none); |
| 77 MojoResult ConsumerDiscardData(uint32_t* num_bytes, | 77 MojoResult ConsumerDiscardData(uint32_t* num_bytes, |
| 78 bool all_or_none); | 78 bool all_or_none); |
| 79 MojoResult ConsumerQueryData(uint32_t* num_bytes); | 79 MojoResult ConsumerQueryData(uint32_t* num_bytes); |
| 80 // This does not validate its arguments. | 80 // This does not validate its arguments. |
| 81 MojoResult ConsumerBeginReadData(const void** buffer, | 81 MojoResult ConsumerBeginReadData(const void** buffer, |
| 82 uint32_t* buffer_num_bytes, | 82 uint32_t* buffer_num_bytes, |
| 83 bool all_or_none); | 83 bool all_or_none); |
| 84 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); | 84 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); |
| 85 MojoResult ConsumerAddWaiter(Waiter* waiter, | 85 MojoResult ConsumerAddWaiter(Waiter* waiter, |
| 86 MojoWaitFlags flags, | 86 MojoHandleSignals signals, |
| 87 uint32_t context); | 87 uint32_t context); |
| 88 void ConsumerRemoveWaiter(Waiter* waiter); | 88 void ConsumerRemoveWaiter(Waiter* waiter); |
| 89 bool ConsumerIsBusy() const; | 89 bool ConsumerIsBusy() const; |
| 90 | 90 |
| 91 protected: | 91 protected: |
| 92 DataPipe(bool has_local_producer, | 92 DataPipe(bool has_local_producer, |
| 93 bool has_local_consumer, | 93 bool has_local_consumer, |
| 94 const MojoCreateDataPipeOptions& validated_options); | 94 const MojoCreateDataPipeOptions& validated_options); |
| 95 | 95 |
| 96 friend class base::RefCountedThreadSafe<DataPipe>; | 96 friend class base::RefCountedThreadSafe<DataPipe>; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 uint32_t producer_two_phase_max_num_bytes_written_; | 196 uint32_t producer_two_phase_max_num_bytes_written_; |
| 197 uint32_t consumer_two_phase_max_num_bytes_read_; | 197 uint32_t consumer_two_phase_max_num_bytes_read_; |
| 198 | 198 |
| 199 DISALLOW_COPY_AND_ASSIGN(DataPipe); | 199 DISALLOW_COPY_AND_ASSIGN(DataPipe); |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace system | 202 } // namespace system |
| 203 } // namespace mojo | 203 } // namespace mojo |
| 204 | 204 |
| 205 #endif // MOJO_SYSTEM_DATA_PIPE_H_ | 205 #endif // MOJO_SYSTEM_DATA_PIPE_H_ |
| OLD | NEW |