blob: 915e41663b8f3e1134c49537999fd0028e890776 [file] [log] [blame]
Scott Graham3eebff02017-06-30 01:07:101// 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
5#ifndef IPC_HANDLE_ATTACHMENT_FUCHSIA_H_
6#define IPC_HANDLE_ATTACHMENT_FUCHSIA_H_
7
8#include <stdint.h>
9
Wez8c49ebc92017-08-10 17:11:1310#include "base/fuchsia/scoped_mx_handle.h"
Scott Graham3eebff02017-06-30 01:07:1011#include "ipc/handle_fuchsia.h"
12#include "ipc/ipc_export.h"
13#include "ipc/ipc_message_attachment.h"
14
15namespace IPC {
16namespace internal {
17
18// This class represents a Fuchsia mx_handle_t attached to a Chrome IPC message.
19class IPC_EXPORT HandleAttachmentFuchsia : public MessageAttachment {
20 public:
21 // This constructor makes a copy of |handle| and takes ownership of the
22 // result. Should only be called by the sender of a Chrome IPC message.
Wez8c49ebc92017-08-10 17:11:1323 explicit HandleAttachmentFuchsia(const mx_handle_t& handle);
Scott Graham3eebff02017-06-30 01:07:1024
Scott Graham3eebff02017-06-30 01:07:1025 // This constructor takes ownership of |handle|. Should only be called by the
26 // receiver of a Chrome IPC message.
Wez71a6a8e2017-08-28 19:38:0527 explicit HandleAttachmentFuchsia(base::ScopedMxHandle handle);
Scott Graham3eebff02017-06-30 01:07:1028
29 Type GetType() const override;
30
Wez8c49ebc92017-08-10 17:11:1331 mx_handle_t Take() { return handle_.release(); }
Scott Graham3eebff02017-06-30 01:07:1032
33 private:
34 ~HandleAttachmentFuchsia() override;
Scott Graham3eebff02017-06-30 01:07:1035
Wez8c49ebc92017-08-10 17:11:1336 base::ScopedMxHandle handle_;
Scott Graham3eebff02017-06-30 01:07:1037};
38
39} // namespace internal
40} // namespace IPC
41
42#endif // IPC_HANDLE_ATTACHMENT_FUCHSIA_H_