ipc_channel_handle.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // 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. #ifndef IPC_IPC_CHANNEL_HANDLE_H_
  5. #define IPC_IPC_CHANNEL_HANDLE_H_
  6. #include "build/build_config.h"
  7. #include "mojo/public/cpp/system/message_pipe.h"
  8. #if BUILDFLAG(IS_NACL)
  9. #include "base/file_descriptor_posix.h"
  10. #endif // defined (OS_NACL)
  11. namespace IPC {
  12. // Note that serialization for this object is defined in the ParamTraits
  13. // template specialization in ipc_message_utils.h.
  14. #if BUILDFLAG(IS_NACL)
  15. struct ChannelHandle {
  16. ChannelHandle() {}
  17. explicit ChannelHandle(const base::FileDescriptor& s) : socket(s) {}
  18. base::FileDescriptor socket;
  19. };
  20. #else
  21. struct ChannelHandle {
  22. ChannelHandle() {}
  23. ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {}
  24. bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); }
  25. mojo::MessagePipeHandle mojo_handle;
  26. };
  27. #endif // BUILDFLAG(IS_NACL)
  28. } // namespace IPC
  29. #endif // IPC_IPC_CHANNEL_HANDLE_H_