[email protected] | a7c03d4f3 | 2012-01-24 02:36:05 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 946d1b2 | 2009-07-22 23:57:21 | [diff] [blame] | 5 | #ifndef IPC_IPC_CHANNEL_HANDLE_H_ |
6 | #define IPC_IPC_CHANNEL_HANDLE_H_ | ||||
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 7 | |
[email protected] | 246a7045 | 2010-03-05 21:53:50 | [diff] [blame] | 8 | #include <string> |
9 | |||||
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 10 | #include "build/build_config.h" |
amistry | 3618252 | 2016-06-27 06:34:42 | [diff] [blame] | 11 | #include "mojo/public/cpp/system/message_pipe.h" |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 12 | |
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 13 | #if defined(OS_NACL_SFI) |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 14 | #include "base/file_descriptor_posix.h" |
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 15 | #endif // defined (OS_NACL_SFI) |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 16 | |
17 | namespace IPC { | ||||
18 | |||||
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 19 | // Note that serialization for this object is defined in the ParamTraits |
20 | // template specialization in ipc_message_utils.h. | ||||
21 | #if defined(OS_NACL_SFI) | ||||
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 22 | struct ChannelHandle { |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 23 | ChannelHandle() {} |
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 24 | explicit ChannelHandle(const base::FileDescriptor& s) : socket(s) {} |
25 | |||||
26 | base::FileDescriptor socket; | ||||
27 | }; | ||||
28 | #else | ||||
29 | struct ChannelHandle { | ||||
30 | ChannelHandle() {} | ||||
amistry | 3618252 | 2016-06-27 06:34:42 | [diff] [blame] | 31 | ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {} |
[email protected] | 42ce94e | 2010-12-08 19:28:09 | [diff] [blame] | 32 | |
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 33 | bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); } |
sammc | e51768c | 2016-10-18 05:48:33 | [diff] [blame] | 34 | |
amistry | 3618252 | 2016-06-27 06:34:42 | [diff] [blame] | 35 | mojo::MessagePipeHandle mojo_handle; |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 36 | }; |
sammc | 9bf370c | 2016-11-14 03:29:08 | [diff] [blame] | 37 | #endif // defined(OS_NACL_SFI) |
[email protected] | d2e884d | 2009-06-22 20:37:52 | [diff] [blame] | 38 | |
39 | } // namespace IPC | ||||
40 | |||||
[email protected] | 946d1b2 | 2009-07-22 23:57:21 | [diff] [blame] | 41 | #endif // IPC_IPC_CHANNEL_HANDLE_H_ |