blob: ef31b8434c4ef6de1c43bd4ff1afe5fa6b593920 [file] [log] [blame]
[email protected]a7c03d4f32012-01-24 02:36:051// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]d2e884d2009-06-22 20:37:522// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]946d1b22009-07-22 23:57:215#ifndef IPC_IPC_CHANNEL_HANDLE_H_
6#define IPC_IPC_CHANNEL_HANDLE_H_
[email protected]d2e884d2009-06-22 20:37:527
[email protected]246a70452010-03-05 21:53:508#include <string>
9
[email protected]d2e884d2009-06-22 20:37:5210#include "build/build_config.h"
amistry36182522016-06-27 06:34:4211#include "mojo/public/cpp/system/message_pipe.h"
[email protected]d2e884d2009-06-22 20:37:5212
sammc9bf370c2016-11-14 03:29:0813#if defined(OS_NACL_SFI)
[email protected]d2e884d2009-06-22 20:37:5214#include "base/file_descriptor_posix.h"
sammc9bf370c2016-11-14 03:29:0815#endif // defined (OS_NACL_SFI)
[email protected]d2e884d2009-06-22 20:37:5216
17namespace IPC {
18
sammc9bf370c2016-11-14 03:29:0819// 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]d2e884d2009-06-22 20:37:5222struct ChannelHandle {
[email protected]d2e884d2009-06-22 20:37:5223 ChannelHandle() {}
sammc9bf370c2016-11-14 03:29:0824 explicit ChannelHandle(const base::FileDescriptor& s) : socket(s) {}
25
26 base::FileDescriptor socket;
27};
28#else
29struct ChannelHandle {
30 ChannelHandle() {}
amistry36182522016-06-27 06:34:4231 ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {}
[email protected]42ce94e2010-12-08 19:28:0932
sammc9bf370c2016-11-14 03:29:0833 bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); }
sammce51768c2016-10-18 05:48:3334
amistry36182522016-06-27 06:34:4235 mojo::MessagePipeHandle mojo_handle;
[email protected]d2e884d2009-06-22 20:37:5236};
sammc9bf370c2016-11-14 03:29:0837#endif // defined(OS_NACL_SFI)
[email protected]d2e884d2009-06-22 20:37:5238
39} // namespace IPC
40
[email protected]946d1b22009-07-22 23:57:2141#endif // IPC_IPC_CHANNEL_HANDLE_H_