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 <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "mojo/edk/embedder/scoped_platform_handle.h" | 13 #include "mojo/edk/platform/scoped_platform_handle.h" |
14 #include "mojo/edk/system/channel_endpoint_client.h" | 14 #include "mojo/edk/system/channel_endpoint_client.h" |
15 #include "mojo/edk/system/handle_signals_state.h" | 15 #include "mojo/edk/system/handle_signals_state.h" |
16 #include "mojo/edk/system/memory.h" | 16 #include "mojo/edk/system/memory.h" |
17 #include "mojo/edk/util/mutex.h" | 17 #include "mojo/edk/util/mutex.h" |
18 #include "mojo/edk/util/ref_ptr.h" | 18 #include "mojo/edk/util/ref_ptr.h" |
19 #include "mojo/edk/util/thread_annotations.h" | 19 #include "mojo/edk/util/thread_annotations.h" |
20 #include "mojo/public/c/system/data_pipe.h" | 20 #include "mojo/public/c/system/data_pipe.h" |
21 #include "mojo/public/c/system/types.h" | 21 #include "mojo/public/c/system/types.h" |
22 #include "mojo/public/cpp/system/macros.h" | 22 #include "mojo/public/cpp/system/macros.h" |
23 | 23 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 HandleSignalsState* signals_state); | 117 HandleSignalsState* signals_state); |
118 void ProducerRemoveAwakable(Awakable* awakable, | 118 void ProducerRemoveAwakable(Awakable* awakable, |
119 HandleSignalsState* signals_state); | 119 HandleSignalsState* signals_state); |
120 void ProducerStartSerialize(Channel* channel, | 120 void ProducerStartSerialize(Channel* channel, |
121 size_t* max_size, | 121 size_t* max_size, |
122 size_t* max_platform_handles); | 122 size_t* max_platform_handles); |
123 bool ProducerEndSerialize( | 123 bool ProducerEndSerialize( |
124 Channel* channel, | 124 Channel* channel, |
125 void* destination, | 125 void* destination, |
126 size_t* actual_size, | 126 size_t* actual_size, |
127 std::vector<embedder::ScopedPlatformHandle>* platform_handles); | 127 std::vector<platform::ScopedPlatformHandle>* platform_handles); |
128 bool ProducerIsBusy() const; | 128 bool ProducerIsBusy() const; |
129 | 129 |
130 // These are called by the consumer dispatcher to implement its methods of | 130 // These are called by the consumer dispatcher to implement its methods of |
131 // corresponding names. | 131 // corresponding names. |
132 void ConsumerCancelAllAwakables(); | 132 void ConsumerCancelAllAwakables(); |
133 void ConsumerClose(); | 133 void ConsumerClose(); |
134 // This does not validate its arguments, except to check that |*num_bytes| is | 134 // This does not validate its arguments, except to check that |*num_bytes| is |
135 // a multiple of |element_num_bytes_|. | 135 // a multiple of |element_num_bytes_|. |
136 MojoResult ConsumerReadData(UserPointer<void> elements, | 136 MojoResult ConsumerReadData(UserPointer<void> elements, |
137 UserPointer<uint32_t> num_bytes, | 137 UserPointer<uint32_t> num_bytes, |
(...skipping 12 matching lines...) Expand all Loading... |
150 HandleSignalsState* signals_state); | 150 HandleSignalsState* signals_state); |
151 void ConsumerRemoveAwakable(Awakable* awakable, | 151 void ConsumerRemoveAwakable(Awakable* awakable, |
152 HandleSignalsState* signals_state); | 152 HandleSignalsState* signals_state); |
153 void ConsumerStartSerialize(Channel* channel, | 153 void ConsumerStartSerialize(Channel* channel, |
154 size_t* max_size, | 154 size_t* max_size, |
155 size_t* max_platform_handles); | 155 size_t* max_platform_handles); |
156 bool ConsumerEndSerialize( | 156 bool ConsumerEndSerialize( |
157 Channel* channel, | 157 Channel* channel, |
158 void* destination, | 158 void* destination, |
159 size_t* actual_size, | 159 size_t* actual_size, |
160 std::vector<embedder::ScopedPlatformHandle>* platform_handles); | 160 std::vector<platform::ScopedPlatformHandle>* platform_handles); |
161 bool ConsumerIsBusy() const; | 161 bool ConsumerIsBusy() const; |
162 | 162 |
163 // The following are only to be used by |DataPipeImpl| (and its subclasses): | 163 // The following are only to be used by |DataPipeImpl| (and its subclasses): |
164 | 164 |
165 // Replaces |impl_| with |new_impl| (which must not be null). For use when | 165 // Replaces |impl_| with |new_impl| (which must not be null). For use when |
166 // serializing data pipe dispatchers (i.e., in |ProducerEndSerialize()| and | 166 // serializing data pipe dispatchers (i.e., in |ProducerEndSerialize()| and |
167 // |ConsumerEndSerialize()|). Returns the old value of |impl_| (in case the | 167 // |ConsumerEndSerialize()|). Returns the old value of |impl_| (in case the |
168 // caller needs to manage its lifetime). | 168 // caller needs to manage its lifetime). |
169 std::unique_ptr<DataPipeImpl> ReplaceImplNoLock( | 169 std::unique_ptr<DataPipeImpl> ReplaceImplNoLock( |
170 std::unique_ptr<DataPipeImpl> new_impl) | 170 std::unique_ptr<DataPipeImpl> new_impl) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); | 278 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); |
279 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); | 279 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); |
280 | 280 |
281 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); | 281 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); |
282 }; | 282 }; |
283 | 283 |
284 } // namespace system | 284 } // namespace system |
285 } // namespace mojo | 285 } // namespace mojo |
286 | 286 |
287 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 287 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |