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

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

Issue 866223005: IPC: Add MojoHandleAttachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing windows build again... Created 5 years, 10 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.gyp ('k') | ipc/mojo/ipc_mojo_handle_attachment.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef IPC_MOJO_IPC_MOJO_HANDLE_ATTACHMENT_H_
6 #define IPC_MOJO_IPC_MOJO_HANDLE_ATTACHMENT_H_
7
8 #include "base/files/file.h"
9 #include "ipc/ipc_export.h"
10 #include "ipc/ipc_message_attachment.h"
11 #include "third_party/mojo/src/mojo/public/cpp/system/handle.h"
12
13 namespace IPC {
14
15 namespace internal {
16
17 // A MessageAttachment that holds a MojoHandle.
18 // * On the sending side, every Mojo handle is a MessagePipe. This is because
19 // any platform files are wrapped by PlatformFileAttachment.
20 // * On the receiving side, the handle can be either MessagePipe or wrapped
21 // platform file: All files, not only MessagePipes are wrapped as a
22 // MojoHandle. The message deserializer should know which type of the object
23 // the handle wraps.
24 class IPC_MOJO_EXPORT MojoHandleAttachment : public MessageAttachment {
25 public:
26 explicit MojoHandleAttachment(mojo::ScopedHandle handle);
27
28 Type GetType() const override;
29
30 #if defined(OS_POSIX)
31 // Returns wrapped file if it wraps a file, or
32 // an invalid fd otherwise. The ownership of handle
33 // is passed to the caller.
34 base::PlatformFile TakePlatformFile() override;
35 #endif // OS_POSIX
36
37 // Returns the owning handle transferring the ownership.
38 mojo::ScopedHandle TakeHandle();
39
40 private:
41 ~MojoHandleAttachment() override;
42 mojo::ScopedHandle handle_;
43
44 DISALLOW_COPY_AND_ASSIGN(MojoHandleAttachment);
45 };
46
47 } // namespace internal
48 } // namespace IPC
49
50 #endif // IPC_MOJO_IPC_MOJO_HANDLE_ATTACHMENT_H_
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_mojo.gyp ('k') | ipc/mojo/ipc_mojo_handle_attachment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698