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

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

Issue 1956843002: EDK: Make TransportData preserve handle rights. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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/channel.cc ('k') | mojo/edk/system/message_in_transit.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_MESSAGE_IN_TRANSIT_H_ 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
6 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ 6 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <ostream> 12 #include <ostream>
13 #include <vector> 13 #include <vector>
14 14
15 #include "mojo/edk/platform/aligned_alloc.h" 15 #include "mojo/edk/platform/aligned_alloc.h"
16 #include "mojo/edk/system/channel_endpoint_id.h" 16 #include "mojo/edk/system/channel_endpoint_id.h"
17 #include "mojo/edk/system/dispatcher.h"
18 #include "mojo/edk/system/handle.h" 17 #include "mojo/edk/system/handle.h"
19 #include "mojo/edk/system/memory.h" 18 #include "mojo/edk/system/memory.h"
20 #include "mojo/public/cpp/system/macros.h" 19 #include "mojo/public/cpp/system/macros.h"
21 20
22 namespace mojo { 21 namespace mojo {
23 namespace system { 22 namespace system {
24 23
25 class Channel; 24 class Channel;
26 class TransportData; 25 class TransportData;
27 26
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // satisified on a faith-based basis. 181 // satisified on a faith-based basis.
183 static bool GetNextMessageSize(const void* buffer, 182 static bool GetNextMessageSize(const void* buffer,
184 size_t buffer_size, 183 size_t buffer_size,
185 size_t* next_message_size); 184 size_t* next_message_size);
186 185
187 // Makes this message "own" the given set of handles. Each handle's dispatcher 186 // Makes this message "own" the given set of handles. Each handle's dispatcher
188 // must not be referenced from anywhere else (in particular, not from any 187 // must not be referenced from anywhere else (in particular, not from any
189 // handle in the handle table), i.e., the dispatcher must have a reference 188 // handle in the handle table), i.e., the dispatcher must have a reference
190 // count of 1. This message must not already have handles. 189 // count of 1. This message must not already have handles.
191 void SetHandles(std::unique_ptr<HandleVector> handles); 190 void SetHandles(std::unique_ptr<HandleVector> handles);
192 // TODO(vtl): Delete this.
193 void SetDispatchers(std::unique_ptr<DispatcherVector> dispatchers);
194 191
195 // Sets the |TransportData| for this message. This should only be done when 192 // Sets the |TransportData| for this message. This should only be done when
196 // there are no handles and no existing |TransportData|. 193 // there are no handles and no existing |TransportData|.
197 void SetTransportData(std::unique_ptr<TransportData> transport_data); 194 void SetTransportData(std::unique_ptr<TransportData> transport_data);
198 195
199 // Serializes any handles to the secondary buffer. This message must not 196 // Serializes any handles to the secondary buffer. This message must not
200 // already have a secondary buffer (so this must only be called once). The 197 // already have a secondary buffer (so this must only be called once). The
201 // caller must ensure (e.g., by holding on to a reference) that |channel| 198 // caller must ensure (e.g., by holding on to a reference) that |channel|
202 // stays alive through the call. 199 // stays alive through the call.
203 void SerializeAndCloseHandles(Channel* channel); 200 void SerializeAndCloseHandles(Channel* channel);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // So logging macros and |DCHECK_EQ()|, etc. work. 296 // So logging macros and |DCHECK_EQ()|, etc. work.
300 inline std::ostream& operator<<(std::ostream& out, 297 inline std::ostream& operator<<(std::ostream& out,
301 MessageInTransit::Subtype subtype) { 298 MessageInTransit::Subtype subtype) {
302 return out << static_cast<uint16_t>(subtype); 299 return out << static_cast<uint16_t>(subtype);
303 } 300 }
304 301
305 } // namespace system 302 } // namespace system
306 } // namespace mojo 303 } // namespace mojo
307 304
308 #endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ 305 #endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/channel.cc ('k') | mojo/edk/system/message_in_transit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698