OLD | NEW |
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_message_helper.h" | 5 #include "ipc/mojo/ipc_mojo_message_helper.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "ipc/mojo/ipc_mojo_handle_attachment.h" | 9 #include "ipc/mojo/ipc_mojo_handle_attachment.h" |
8 | 10 |
9 namespace IPC { | 11 namespace IPC { |
10 | 12 |
11 // static | 13 // static |
12 bool MojoMessageHelper::WriteMessagePipeTo( | 14 bool MojoMessageHelper::WriteMessagePipeTo( |
13 Message* message, | 15 Message* message, |
14 mojo::ScopedMessagePipeHandle handle) { | 16 mojo::ScopedMessagePipeHandle handle) { |
15 message->WriteAttachment(new internal::MojoHandleAttachment( | 17 message->WriteAttachment(new internal::MojoHandleAttachment( |
16 mojo::ScopedHandle::From(handle.Pass()))); | 18 mojo::ScopedHandle::From(std::move(handle)))); |
17 return true; | 19 return true; |
18 } | 20 } |
19 | 21 |
20 // static | 22 // static |
21 bool MojoMessageHelper::ReadMessagePipeFrom( | 23 bool MojoMessageHelper::ReadMessagePipeFrom( |
22 const Message* message, | 24 const Message* message, |
23 base::PickleIterator* iter, | 25 base::PickleIterator* iter, |
24 mojo::ScopedMessagePipeHandle* handle) { | 26 mojo::ScopedMessagePipeHandle* handle) { |
25 scoped_refptr<MessageAttachment> attachment; | 27 scoped_refptr<MessageAttachment> attachment; |
26 if (!message->ReadAttachment(iter, &attachment)) { | 28 if (!message->ReadAttachment(iter, &attachment)) { |
(...skipping 11 matching lines...) Expand all Loading... |
38 ->TakeHandle() | 40 ->TakeHandle() |
39 .release() | 41 .release() |
40 .value())); | 42 .value())); |
41 return true; | 43 return true; |
42 } | 44 } |
43 | 45 |
44 MojoMessageHelper::MojoMessageHelper() { | 46 MojoMessageHelper::MojoMessageHelper() { |
45 } | 47 } |
46 | 48 |
47 } // namespace IPC | 49 } // namespace IPC |
OLD | NEW |