Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: ipc/mojo/ipc_mojo_handle_attachment.cc

Issue 2047953002: Explicitly serialise platform file attachments instead of doing them implicitly as a mojo handle at… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/mojo/ipc_mojo_handle_attachment.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/mojo/ipc_mojo_handle_attachment.h" 5 #include "ipc/mojo/ipc_mojo_handle_attachment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ipc/ipc_message_attachment_set.h"
11 #include "mojo/edk/embedder/embedder.h"
12 10
13 namespace IPC { 11 namespace IPC {
14 namespace internal { 12 namespace internal {
15 13
16 MojoHandleAttachment::MojoHandleAttachment(mojo::ScopedHandle handle) 14 MojoHandleAttachment::MojoHandleAttachment(mojo::ScopedHandle handle)
17 : handle_(std::move(handle)) {} 15 : handle_(std::move(handle)) {}
18 16
19 MojoHandleAttachment::~MojoHandleAttachment() { 17 MojoHandleAttachment::~MojoHandleAttachment() {
20 } 18 }
21 19
22 MessageAttachment::Type MojoHandleAttachment::GetType() const { 20 MessageAttachment::Type MojoHandleAttachment::GetType() const {
23 return TYPE_MOJO_HANDLE; 21 return TYPE_MOJO_HANDLE;
24 } 22 }
25 23
26 #if defined(OS_POSIX) 24 #if defined(OS_POSIX)
27 base::PlatformFile MojoHandleAttachment::TakePlatformFile() { 25 base::PlatformFile MojoHandleAttachment::TakePlatformFile() {
28 mojo::edk::ScopedPlatformHandle platform_handle; 26 NOTREACHED();
29 MojoResult unwrap_result = mojo::edk::PassWrappedPlatformHandle( 27 return base::kInvalidPlatformFile;
30 handle_.release().value(), &platform_handle);
31 if (unwrap_result != MOJO_RESULT_OK) {
32 LOG(ERROR) << "Pipe failed to covert handles. Closing: " << unwrap_result;
33 return -1;
34 }
35
36 return platform_handle.release().handle;
37 } 28 }
38 #endif // OS_POSIX 29 #endif // OS_POSIX
39 30
40 mojo::ScopedHandle MojoHandleAttachment::TakeHandle() { 31 mojo::ScopedHandle MojoHandleAttachment::TakeHandle() {
41 return std::move(handle_); 32 return std::move(handle_);
42 } 33 }
43 34
44 } // namespace internal 35 } // namespace internal
45 } // namespace IPC 36 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_mojo_handle_attachment.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698