summaryrefslogtreecommitdiff
path: root/chromium/ipc/handle_attachment_fuchsia.cc
blob: 305e98c6e9a9644e6ffb7118740b016ef22161bf (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 <zircon/syscalls.h>
#include <zircon/types.h>

namespace IPC {
namespace internal {

HandleAttachmentFuchsia::HandleAttachmentFuchsia(const zx_handle_t& handle) {
  zx_status_t result =
      zx_handle_duplicate(handle, ZX_RIGHT_SAME_RIGHTS, handle_.receive());
  DLOG_IF(ERROR, result != ZX_OK)
      << "zx_handle_duplicate: " << zx_status_get_string(result);
}

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

HandleAttachmentFuchsia::~HandleAttachmentFuchsia() {}

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

}  // namespace internal
}  // namespace IPC