amit@chromium.org | 3729074 | 2012-01-24 11:36:05 +0900 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [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 | |
| 5 | #ifndef IPC_IPC_CHANNEL_HANDLE_H_ |
| 6 | #define IPC_IPC_CHANNEL_HANDLE_H_ |
| 7 | |
apatrick@chromium.org | bcd2b35 | 2010-03-06 06:53:50 +0900 | [diff] [blame] | 8 | #include <string> |
| 9 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 10 | #include "build/build_config.h" |
amistry | 70d6357 | 2016-06-27 15:34:42 +0900 | [diff] [blame] | 11 | #include "mojo/public/cpp/system/message_pipe.h" |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 12 | |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [diff] [blame] | 13 | #if defined(OS_NACL_SFI) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 14 | #include "base/file_descriptor_posix.h" |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [diff] [blame] | 15 | #endif // defined (OS_NACL_SFI) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 16 | |
| 17 | namespace IPC { |
| 18 | |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [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) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 22 | struct ChannelHandle { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 23 | ChannelHandle() {} |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [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 | 70d6357 | 2016-06-27 15:34:42 +0900 | [diff] [blame] | 31 | ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {} |
dmaclach@chromium.org | 058c4a7 | 2010-12-09 04:28:09 +0900 | [diff] [blame] | 32 | |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [diff] [blame] | 33 | bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); } |
sammc | 14126a8 | 2016-10-18 14:48:33 +0900 | [diff] [blame] | 34 | |
amistry | 70d6357 | 2016-06-27 15:34:42 +0900 | [diff] [blame] | 35 | mojo::MessagePipeHandle mojo_handle; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 36 | }; |
sammc | 5aeaa8a | 2016-11-14 12:29:08 +0900 | [diff] [blame] | 37 | #endif // defined(OS_NACL_SFI) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 38 | |
| 39 | } // namespace IPC |
| 40 | |
| 41 | #endif // IPC_IPC_CHANNEL_HANDLE_H_ |