cc: Drop skip_shared_out_of_order_tiles field from TilingSetEvictionQueue.
[chromium-blink-merge.git] / ipc / mojo / ipc_mojo_handle_attachment.cc
blob98ac5c3c5e0e3d8705379f5e0d9aa27027b35155
1 // Copyright (c) 2015 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.
5 #include "ipc/mojo/ipc_mojo_handle_attachment.h"
7 #include "ipc/ipc_message_attachment_set.h"
8 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
10 namespace IPC {
11 namespace internal {
13 MojoHandleAttachment::MojoHandleAttachment(mojo::ScopedHandle handle)
14 : handle_(handle.Pass()) {
17 MojoHandleAttachment::~MojoHandleAttachment() {
20 MessageAttachment::Type MojoHandleAttachment::GetType() const {
21 return TYPE_MOJO_HANDLE;
24 #if defined(OS_POSIX)
25 base::PlatformFile MojoHandleAttachment::TakePlatformFile() {
26 mojo::embedder::ScopedPlatformHandle platform_handle;
27 MojoResult unwrap_result = mojo::embedder::PassWrappedPlatformHandle(
28 handle_.release().value(), &platform_handle);
29 if (unwrap_result != MOJO_RESULT_OK) {
30 LOG(ERROR) << "Pipe failed to covert handles. Closing: " << unwrap_result;
31 return -1;
34 return platform_handle.release().fd;
36 #endif // OS_POSIX
38 mojo::ScopedHandle MojoHandleAttachment::TakeHandle() {
39 return handle_.Pass();
42 } // namespace internal
43 } // namespace IPC