blob: ef31b8434c4ef6de1c43bd4ff1afe5fa6b593920 [file] [log] [blame]
Hidehiko Abeb268b432018-04-24 01:37:19 +09001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
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
8#include <string>
9
10#include "build/build_config.h"
11#include "mojo/public/cpp/system/message_pipe.h"
12
13#if defined(OS_NACL_SFI)
14#include "base/file_descriptor_posix.h"
15#endif // defined (OS_NACL_SFI)
16
17namespace IPC {
18
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)
22struct ChannelHandle {
23 ChannelHandle() {}
24 explicit ChannelHandle(const base::FileDescriptor& s) : socket(s) {}
25
26 base::FileDescriptor socket;
27};
28#else
29struct ChannelHandle {
30 ChannelHandle() {}
31 ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {}
32
33 bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); }
34
35 mojo::MessagePipeHandle mojo_handle;
36};
37#endif // defined(OS_NACL_SFI)
38
39} // namespace IPC
40
41#endif // IPC_IPC_CHANNEL_HANDLE_H_