OLD | NEW |
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_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_ | 5 #ifndef MOJO_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_ |
6 #define MOJO_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_ | 6 #define MOJO_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_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 <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "mojo/embedder/platform_handle.h" | 14 #include "mojo/embedder/platform_handle.h" |
| 15 #include "mojo/embedder/platform_handle_vector.h" |
15 #include "mojo/system/system_impl_export.h" | 16 #include "mojo/system/system_impl_export.h" |
16 | 17 |
17 struct iovec; // Declared in <sys/uio.h>. | 18 struct iovec; // Declared in <sys/uio.h>. |
18 | 19 |
19 namespace mojo { | 20 namespace mojo { |
20 namespace embedder { | 21 namespace embedder { |
21 | 22 |
22 // The maximum number of handles that can be sent "at once" using | 23 // The maximum number of handles that can be sent "at once" using |
23 // |PlatformChannelSendHandles()|. | 24 // |PlatformChannelSendHandles()|. |
24 // TODO(vtl): This number is taken from ipc/file_descriptor_set_posix.h: | 25 // TODO(vtl): This number is taken from ipc/file_descriptor_set_posix.h: |
25 // |FileDescriptorSet::kMaxDescriptorsPerMessage|. Where does it come from? | 26 // |FileDescriptorSet::kMaxDescriptorsPerMessage|. Where does it come from? |
26 const size_t kPlatformChannelMaxNumHandles = 7; | 27 const size_t kPlatformChannelMaxNumHandles = 7; |
27 | 28 |
28 typedef std::vector<PlatformHandle> PlatformHandleVector; | |
29 | |
30 // Use these to write to a socket created using |PlatformChannelPair| (or | 29 // Use these to write to a socket created using |PlatformChannelPair| (or |
31 // equivalent). These are like |write()| and |writev()|, but handle |EINTR| and | 30 // equivalent). These are like |write()| and |writev()|, but handle |EINTR| and |
32 // never raise |SIGPIPE|. (Note: On Mac, the suppression of |SIGPIPE| is set up | 31 // never raise |SIGPIPE|. (Note: On Mac, the suppression of |SIGPIPE| is set up |
33 // by |PlatformChannelPair|.) | 32 // by |PlatformChannelPair|.) |
34 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelWrite(PlatformHandle h, | 33 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelWrite(PlatformHandle h, |
35 const void* bytes, | 34 const void* bytes, |
36 size_t num_bytes); | 35 size_t num_bytes); |
37 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelWritev(PlatformHandle h, | 36 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelWritev(PlatformHandle h, |
38 struct iovec* iov, | 37 struct iovec* iov, |
39 size_t num_iov); | 38 size_t num_iov); |
(...skipping 15 matching lines...) Expand all Loading... |
55 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelRecvmsg( | 54 MOJO_SYSTEM_IMPL_EXPORT ssize_t PlatformChannelRecvmsg( |
56 PlatformHandle h, | 55 PlatformHandle h, |
57 void* buf, | 56 void* buf, |
58 size_t num_bytes, | 57 size_t num_bytes, |
59 scoped_ptr<PlatformHandleVector>* handles); | 58 scoped_ptr<PlatformHandleVector>* handles); |
60 | 59 |
61 } // namespace embedder | 60 } // namespace embedder |
62 } // namespace mojo | 61 } // namespace mojo |
63 | 62 |
64 #endif // MOJO_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_ | 63 #endif // MOJO_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_ |
OLD | NEW |