handle_attachment_fuchsia.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2017 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_HANDLE_ATTACHMENT_FUCHSIA_H_
  5. #define IPC_HANDLE_ATTACHMENT_FUCHSIA_H_
  6. #include <lib/zx/handle.h>
  7. #include <stdint.h>
  8. #include "ipc/ipc_message_attachment.h"
  9. #include "ipc/ipc_message_support_export.h"
  10. namespace IPC {
  11. namespace internal {
  12. // This class represents a Fuchsia zx_handle_t attached to a Chrome IPC message.
  13. class IPC_MESSAGE_SUPPORT_EXPORT HandleAttachmentFuchsia
  14. : public MessageAttachment {
  15. public:
  16. // This constructor takes ownership of |handle|. Should only be called by the
  17. // receiver of a Chrome IPC message.
  18. explicit HandleAttachmentFuchsia(zx::handle handle);
  19. Type GetType() const override;
  20. zx_handle_t Take() { return handle_.release(); }
  21. private:
  22. ~HandleAttachmentFuchsia() override;
  23. zx::handle handle_;
  24. };
  25. } // namespace internal
  26. } // namespace IPC
  27. #endif // IPC_HANDLE_ATTACHMENT_FUCHSIA_H_