xref: /aosp_15_r20/external/cronet/ipc/handle_attachment_fuchsia.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
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_HANDLE_ATTACHMENT_FUCHSIA_H_
6 #define IPC_HANDLE_ATTACHMENT_FUCHSIA_H_
7 
8 #include <lib/zx/handle.h>
9 #include <stdint.h>
10 
11 #include "ipc/ipc_message_attachment.h"
12 #include "ipc/ipc_message_support_export.h"
13 
14 namespace IPC {
15 namespace internal {
16 
17 // This class represents a Fuchsia zx_handle_t attached to a Chrome IPC message.
18 class IPC_MESSAGE_SUPPORT_EXPORT HandleAttachmentFuchsia
19     : public MessageAttachment {
20  public:
21   // This constructor takes ownership of |handle|. Should only be called by the
22   // receiver of a Chrome IPC message.
23   explicit HandleAttachmentFuchsia(zx::handle handle);
24 
25   Type GetType() const override;
26 
Take()27   zx_handle_t Take() { return handle_.release(); }
28 
29  private:
30   ~HandleAttachmentFuchsia() override;
31 
32   zx::handle handle_;
33 };
34 
35 }  // namespace internal
36 }  // namespace IPC
37 
38 #endif  // IPC_HANDLE_ATTACHMENT_FUCHSIA_H_
39