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

Side by Side Diff: mojo/edk/system/data_pipe.h

Issue 2084593005: Rationalize AddAwakable...() and RemoveAwakable...() methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh Created 4 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
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/data_pipe.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 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>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 MojoResult ProducerSetOptions(uint32_t write_threshold_num_bytes); 108 MojoResult ProducerSetOptions(uint32_t write_threshold_num_bytes);
109 void ProducerGetOptions(uint32_t* write_threshold_num_bytes); 109 void ProducerGetOptions(uint32_t* write_threshold_num_bytes);
110 MojoResult ProducerWriteData(UserPointer<const void> elements, 110 MojoResult ProducerWriteData(UserPointer<const void> elements,
111 UserPointer<uint32_t> num_bytes, 111 UserPointer<uint32_t> num_bytes,
112 bool all_or_none); 112 bool all_or_none);
113 MojoResult ProducerBeginWriteData(UserPointer<void*> buffer, 113 MojoResult ProducerBeginWriteData(UserPointer<void*> buffer,
114 UserPointer<uint32_t> buffer_num_bytes); 114 UserPointer<uint32_t> buffer_num_bytes);
115 MojoResult ProducerEndWriteData(uint32_t num_bytes_written); 115 MojoResult ProducerEndWriteData(uint32_t num_bytes_written);
116 HandleSignalsState ProducerGetHandleSignalsState(); 116 HandleSignalsState ProducerGetHandleSignalsState();
117 MojoResult ProducerAddAwakable(Awakable* awakable, 117 MojoResult ProducerAddAwakable(Awakable* awakable,
118 uint64_t context,
119 bool force,
118 MojoHandleSignals signals, 120 MojoHandleSignals signals,
119 bool force,
120 uint64_t context,
121 HandleSignalsState* signals_state); 121 HandleSignalsState* signals_state);
122 void ProducerRemoveAwakable(Awakable* awakable, 122 void ProducerRemoveAwakable(bool match_context,
123 Awakable* awakable,
124 uint64_t context,
123 HandleSignalsState* signals_state); 125 HandleSignalsState* signals_state);
124 void ProducerRemoveAwakableWithContext(Awakable* awakable,
125 uint64_t context,
126 HandleSignalsState* signals_state);
127 void ProducerStartSerialize(Channel* channel, 126 void ProducerStartSerialize(Channel* channel,
128 size_t* max_size, 127 size_t* max_size,
129 size_t* max_platform_handles); 128 size_t* max_platform_handles);
130 bool ProducerEndSerialize( 129 bool ProducerEndSerialize(
131 Channel* channel, 130 Channel* channel,
132 void* destination, 131 void* destination,
133 size_t* actual_size, 132 size_t* actual_size,
134 std::vector<platform::ScopedPlatformHandle>* platform_handles); 133 std::vector<platform::ScopedPlatformHandle>* platform_handles);
135 134
136 // These are called by the consumer dispatcher to implement its methods of 135 // These are called by the consumer dispatcher to implement its methods of
137 // corresponding names. 136 // corresponding names.
138 void ConsumerCancelAllState(); 137 void ConsumerCancelAllState();
139 void ConsumerClose(); 138 void ConsumerClose();
140 MojoResult ConsumerSetOptions(uint32_t read_threshold_num_bytes); 139 MojoResult ConsumerSetOptions(uint32_t read_threshold_num_bytes);
141 void ConsumerGetOptions(uint32_t* read_threshold_num_bytes); 140 void ConsumerGetOptions(uint32_t* read_threshold_num_bytes);
142 // This does not validate its arguments, except to check that |*num_bytes| is 141 // This does not validate its arguments, except to check that |*num_bytes| is
143 // a multiple of |element_num_bytes_|. 142 // a multiple of |element_num_bytes_|.
144 MojoResult ConsumerReadData(UserPointer<void> elements, 143 MojoResult ConsumerReadData(UserPointer<void> elements,
145 UserPointer<uint32_t> num_bytes, 144 UserPointer<uint32_t> num_bytes,
146 bool all_or_none, 145 bool all_or_none,
147 bool peek); 146 bool peek);
148 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes, 147 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes,
149 bool all_or_none); 148 bool all_or_none);
150 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes); 149 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes);
151 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer, 150 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer,
152 UserPointer<uint32_t> buffer_num_bytes); 151 UserPointer<uint32_t> buffer_num_bytes);
153 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); 152 MojoResult ConsumerEndReadData(uint32_t num_bytes_read);
154 HandleSignalsState ConsumerGetHandleSignalsState(); 153 HandleSignalsState ConsumerGetHandleSignalsState();
155 MojoResult ConsumerAddAwakable(Awakable* awakable, 154 MojoResult ConsumerAddAwakable(Awakable* awakable,
155 uint64_t context,
156 bool force,
156 MojoHandleSignals signals, 157 MojoHandleSignals signals,
157 bool force,
158 uint64_t context,
159 HandleSignalsState* signals_state); 158 HandleSignalsState* signals_state);
160 void ConsumerRemoveAwakable(Awakable* awakable, 159 void ConsumerRemoveAwakable(bool match_context,
160 Awakable* awakable,
161 uint64_t context,
161 HandleSignalsState* signals_state); 162 HandleSignalsState* signals_state);
162 void ConsumerRemoveAwakableWithContext(Awakable* awakable,
163 uint64_t context,
164 HandleSignalsState* signals_state);
165 void ConsumerStartSerialize(Channel* channel, 163 void ConsumerStartSerialize(Channel* channel,
166 size_t* max_size, 164 size_t* max_size,
167 size_t* max_platform_handles); 165 size_t* max_platform_handles);
168 bool ConsumerEndSerialize( 166 bool ConsumerEndSerialize(
169 Channel* channel, 167 Channel* channel,
170 void* destination, 168 void* destination,
171 size_t* actual_size, 169 size_t* actual_size,
172 std::vector<platform::ScopedPlatformHandle>* platform_handles); 170 std::vector<platform::ScopedPlatformHandle>* platform_handles);
173 171
174 // The following are only to be used by |DataPipeImpl| (and its subclasses): 172 // The following are only to be used by |DataPipeImpl| (and its subclasses):
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); 311 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_);
314 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); 312 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_);
315 313
316 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); 314 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe);
317 }; 315 };
318 316
319 } // namespace system 317 } // namespace system
320 } // namespace mojo 318 } // namespace mojo
321 319
322 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ 320 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/system/data_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698