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 #ifndef IPC_IPC_MESSAGE_ATTACHMENT_H_ | 5 #ifndef IPC_IPC_MESSAGE_ATTACHMENT_H_ |
6 #define IPC_IPC_MESSAGE_ATTACHMENT_H_ | 6 #define IPC_IPC_MESSAGE_ATTACHMENT_H_ |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "ipc/ipc.mojom.h" |
13 #include "ipc/ipc_export.h" | 14 #include "ipc/ipc_export.h" |
14 | 15 |
15 namespace IPC { | 16 namespace IPC { |
16 | 17 |
17 // Auxiliary data sent with |Message|. This can be a platform file descriptor | 18 // Auxiliary data sent with |Message|. This can be a platform file descriptor |
18 // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. | 19 // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. |
19 class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment { | 20 class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment { |
20 public: | 21 public: |
21 enum Type { | 22 using Type = mojom::SerializedHandle::Type; |
22 TYPE_PLATFORM_FILE, // The instance is |PlatformFileAttachment|. | |
23 TYPE_MOJO_HANDLE, // The instance is |MojoHandleAttachment|. | |
24 TYPE_BROKERABLE_ATTACHMENT, // The instance is |BrokerableAttachment|. | |
25 }; | |
26 | 23 |
27 virtual Type GetType() const = 0; | 24 virtual Type GetType() const = 0; |
28 | 25 |
29 #if defined(OS_POSIX) | |
30 virtual base::PlatformFile TakePlatformFile() = 0; | |
31 #endif // OS_POSIX | |
32 | |
33 protected: | 26 protected: |
34 friend class base::RefCountedThreadSafe<MessageAttachment>; | 27 friend class base::RefCountedThreadSafe<MessageAttachment>; |
35 MessageAttachment(); | 28 MessageAttachment(); |
36 ~MessageAttachment() override; | 29 ~MessageAttachment() override; |
37 | 30 |
38 DISALLOW_COPY_AND_ASSIGN(MessageAttachment); | 31 DISALLOW_COPY_AND_ASSIGN(MessageAttachment); |
39 }; | 32 }; |
40 | 33 |
41 } // namespace IPC | 34 } // namespace IPC |
42 | 35 |
43 #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ | 36 #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ |
OLD | NEW |