summaryrefslogtreecommitdiff
path: root/chromium/ipc/handle_attachment_fuchsia.cc
blob: 88cf5184dd6bd4c1cf99419316af8bd8059cd319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ipc/handle_attachment_fuchsia.h"

#include <magenta/syscalls.h>
#include <magenta/types.h>

namespace IPC {
namespace internal {

HandleAttachmentFuchsia::HandleAttachmentFuchsia(const mx_handle_t& handle) {
  mx_status_t result =
      mx_handle_duplicate(handle, MX_RIGHT_SAME_RIGHTS, handle_.receive());
  DLOG_IF(ERROR, result != MX_OK)
      << "mx_handle_duplicate: " << mx_status_get_string(result);
}

HandleAttachmentFuchsia::HandleAttachmentFuchsia(base::ScopedMxHandle handle)
    : handle_(std::move(handle)) {}

HandleAttachmentFuchsia::~HandleAttachmentFuchsia() {}

MessageAttachment::Type HandleAttachmentFuchsia::GetType() const {
  return Type::FUCHSIA_HANDLE;
}

}  // namespace internal
}  // namespace IPC