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

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

Issue 1478503003: EDK: Convert most uses of PlatformHandleVector to std::vector<ScopedPlatformHandle>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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/channel.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>
11 #include <vector>
11 12
12 #include "mojo/edk/embedder/platform_handle_vector.h" 13 #include "mojo/edk/embedder/scoped_platform_handle.h"
13 #include "mojo/edk/system/channel_endpoint_client.h" 14 #include "mojo/edk/system/channel_endpoint_client.h"
14 #include "mojo/edk/system/handle_signals_state.h" 15 #include "mojo/edk/system/handle_signals_state.h"
15 #include "mojo/edk/system/memory.h" 16 #include "mojo/edk/system/memory.h"
16 #include "mojo/edk/util/mutex.h" 17 #include "mojo/edk/util/mutex.h"
17 #include "mojo/edk/util/ref_ptr.h" 18 #include "mojo/edk/util/ref_ptr.h"
18 #include "mojo/edk/util/thread_annotations.h" 19 #include "mojo/edk/util/thread_annotations.h"
19 #include "mojo/public/c/system/data_pipe.h" 20 #include "mojo/public/c/system/data_pipe.h"
20 #include "mojo/public/c/system/types.h" 21 #include "mojo/public/c/system/types.h"
21 #include "mojo/public/cpp/system/macros.h" 22 #include "mojo/public/cpp/system/macros.h"
22 23
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 HandleSignalsState ProducerGetHandleSignalsState(); 113 HandleSignalsState ProducerGetHandleSignalsState();
113 MojoResult ProducerAddAwakable(Awakable* awakable, 114 MojoResult ProducerAddAwakable(Awakable* awakable,
114 MojoHandleSignals signals, 115 MojoHandleSignals signals,
115 uint32_t context, 116 uint32_t context,
116 HandleSignalsState* signals_state); 117 HandleSignalsState* signals_state);
117 void ProducerRemoveAwakable(Awakable* awakable, 118 void ProducerRemoveAwakable(Awakable* awakable,
118 HandleSignalsState* signals_state); 119 HandleSignalsState* signals_state);
119 void ProducerStartSerialize(Channel* channel, 120 void ProducerStartSerialize(Channel* channel,
120 size_t* max_size, 121 size_t* max_size,
121 size_t* max_platform_handles); 122 size_t* max_platform_handles);
122 bool ProducerEndSerialize(Channel* channel, 123 bool ProducerEndSerialize(
123 void* destination, 124 Channel* channel,
124 size_t* actual_size, 125 void* destination,
125 embedder::PlatformHandleVector* platform_handles); 126 size_t* actual_size,
127 std::vector<embedder::ScopedPlatformHandle>* platform_handles);
126 bool ProducerIsBusy() const; 128 bool ProducerIsBusy() const;
127 129
128 // 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
129 // corresponding names. 131 // corresponding names.
130 void ConsumerCancelAllAwakables(); 132 void ConsumerCancelAllAwakables();
131 void ConsumerClose(); 133 void ConsumerClose();
132 // 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
133 // a multiple of |element_num_bytes_|. 135 // a multiple of |element_num_bytes_|.
134 MojoResult ConsumerReadData(UserPointer<void> elements, 136 MojoResult ConsumerReadData(UserPointer<void> elements,
135 UserPointer<uint32_t> num_bytes, 137 UserPointer<uint32_t> num_bytes,
136 bool all_or_none, 138 bool all_or_none,
137 bool peek); 139 bool peek);
138 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes, 140 MojoResult ConsumerDiscardData(UserPointer<uint32_t> num_bytes,
139 bool all_or_none); 141 bool all_or_none);
140 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes); 142 MojoResult ConsumerQueryData(UserPointer<uint32_t> num_bytes);
141 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer, 143 MojoResult ConsumerBeginReadData(UserPointer<const void*> buffer,
142 UserPointer<uint32_t> buffer_num_bytes); 144 UserPointer<uint32_t> buffer_num_bytes);
143 MojoResult ConsumerEndReadData(uint32_t num_bytes_read); 145 MojoResult ConsumerEndReadData(uint32_t num_bytes_read);
144 HandleSignalsState ConsumerGetHandleSignalsState(); 146 HandleSignalsState ConsumerGetHandleSignalsState();
145 MojoResult ConsumerAddAwakable(Awakable* awakable, 147 MojoResult ConsumerAddAwakable(Awakable* awakable,
146 MojoHandleSignals signals, 148 MojoHandleSignals signals,
147 uint32_t context, 149 uint32_t context,
148 HandleSignalsState* signals_state); 150 HandleSignalsState* signals_state);
149 void ConsumerRemoveAwakable(Awakable* awakable, 151 void ConsumerRemoveAwakable(Awakable* awakable,
150 HandleSignalsState* signals_state); 152 HandleSignalsState* signals_state);
151 void ConsumerStartSerialize(Channel* channel, 153 void ConsumerStartSerialize(Channel* channel,
152 size_t* max_size, 154 size_t* max_size,
153 size_t* max_platform_handles); 155 size_t* max_platform_handles);
154 bool ConsumerEndSerialize(Channel* channel, 156 bool ConsumerEndSerialize(
155 void* destination, 157 Channel* channel,
156 size_t* actual_size, 158 void* destination,
157 embedder::PlatformHandleVector* platform_handles); 159 size_t* actual_size,
160 std::vector<embedder::ScopedPlatformHandle>* platform_handles);
158 bool ConsumerIsBusy() const; 161 bool ConsumerIsBusy() const;
159 162
160 // 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):
161 164
162 // 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
163 // serializing data pipe dispatchers (i.e., in |ProducerEndSerialize()| and 166 // serializing data pipe dispatchers (i.e., in |ProducerEndSerialize()| and
164 // |ConsumerEndSerialize()|). Returns the old value of |impl_| (in case the 167 // |ConsumerEndSerialize()|). Returns the old value of |impl_| (in case the
165 // caller needs to manage its lifetime). 168 // caller needs to manage its lifetime).
166 std::unique_ptr<DataPipeImpl> ReplaceImplNoLock( 169 std::unique_ptr<DataPipeImpl> ReplaceImplNoLock(
167 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
275 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_);
276 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); 279 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_);
277 280
278 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); 281 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe);
279 }; 282 };
280 283
281 } // namespace system 284 } // namespace system
282 } // namespace mojo 285 } // namespace mojo
283 286
284 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ 287 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | mojo/edk/system/data_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698