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

Side by Side Diff: mojo/edk/embedder/platform_channel_utils.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_ 5 #ifndef MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_
6 #define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_ 6 #define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/types.h> // For |ssize_t|. 9 #include <sys/types.h> // For |ssize_t|.
10 10
11 #include <deque> 11 #include <deque>
12 12
13 #include "mojo/edk/embedder/platform_handle.h" 13 #include "mojo/edk/embedder/platform_handle.h"
14 #include "mojo/edk/embedder/scoped_platform_handle.h"
14 15
15 struct iovec; // Declared in <sys/uio.h>. 16 struct iovec; // Declared in <sys/uio.h>.
16 17
17 namespace mojo { 18 namespace mojo {
18 namespace embedder { 19 namespace embedder {
19 20
20 // The maximum number of handles that can be sent "at once" using 21 // The maximum number of handles that can be sent "at once" using
21 // |PlatformChannelSendmsgWithHandles()|. 22 // |PlatformChannelSendmsgWithHandles()|.
22 // TODO(vtl): This number is taken from ipc/ipc_message_attachment_set.h: 23 // TODO(vtl): This number is taken from ipc/ipc_message_attachment_set.h:
23 // |IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage|. 24 // |IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage|.
(...skipping 30 matching lines...) Expand all
54 // (e.g., created using PlatformChannelPair|). (These will be sent in a single 55 // (e.g., created using PlatformChannelPair|). (These will be sent in a single
55 // message having one null byte of data and one control message header with all 56 // message having one null byte of data and one control message header with all
56 // the file descriptors.) All of the handles must be valid, and there must be at 57 // the file descriptors.) All of the handles must be valid, and there must be at
57 // most |kPlatformChannelMaxNumHandles| (and at least one handle). Returns true 58 // most |kPlatformChannelMaxNumHandles| (and at least one handle). Returns true
58 // on success, in which case it closes all the handles. 59 // on success, in which case it closes all the handles.
59 bool PlatformChannelSendHandles(PlatformHandle h, 60 bool PlatformChannelSendHandles(PlatformHandle h,
60 PlatformHandle* handles, 61 PlatformHandle* handles,
61 size_t num_handles); 62 size_t num_handles);
62 63
63 // Wrapper around |recvmsg()|, which will extract any attached file descriptors 64 // Wrapper around |recvmsg()|, which will extract any attached file descriptors
64 // (in the control message) to |PlatformHandle|s (and append them to 65 // (in the control message) to |ScopedPlatformHandle|s (and append them to
65 // |platform_handles|). (This also handles |EINTR|.) 66 // |platform_handles|). (This also handles |EINTR|.)
66 ssize_t PlatformChannelRecvmsg(PlatformHandle h, 67 ssize_t PlatformChannelRecvmsg(
67 void* buf, 68 PlatformHandle h,
68 size_t num_bytes, 69 void* buf,
69 std::deque<PlatformHandle>* platform_handles); 70 size_t num_bytes,
71 std::deque<ScopedPlatformHandle>* platform_handles);
70 72
71 } // namespace embedder 73 } // namespace embedder
72 } // namespace mojo 74 } // namespace mojo
73 75
74 #endif // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_ 76 #endif // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_H_
OLDNEW
« no previous file with comments | « mojo/edk/embedder/platform_channel_pair_unittest.cc ('k') | mojo/edk/embedder/platform_channel_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698