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" |
| 9 #include "base/macros.h" |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "ipc/ipc_export.h" | 11 #include "ipc/ipc_export.h" |
10 | 12 |
11 namespace IPC { | 13 namespace IPC { |
12 | 14 |
13 // Auxiliary data sent with |Message|. This can be a platform file descriptor | 15 // Auxiliary data sent with |Message|. This can be a platform file descriptor |
14 // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. | 16 // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. |
15 class IPC_EXPORT MessageAttachment | 17 class IPC_EXPORT MessageAttachment |
16 : public base::RefCounted<MessageAttachment> { | 18 : public base::RefCounted<MessageAttachment> { |
17 public: | 19 public: |
18 enum Type { | 20 enum Type { |
19 TYPE_PLATFORM_FILE, // The instance is |PlatformFileAttachment|. | 21 TYPE_PLATFORM_FILE, // The instance is |PlatformFileAttachment|. |
20 TYPE_MOJO_MESSAGE_PIPE, // The instance is a mojo-based class. | 22 TYPE_MOJO_MESSAGE_PIPE, // The instance is a mojo-based class. |
21 }; | 23 }; |
22 | 24 |
23 virtual Type GetType() const = 0; | 25 virtual Type GetType() const = 0; |
| 26 virtual base::PlatformFile TakePlatformFile() = 0; |
24 | 27 |
25 protected: | 28 protected: |
26 friend class base::RefCounted<MessageAttachment>; | 29 friend class base::RefCounted<MessageAttachment>; |
| 30 MessageAttachment(); |
27 virtual ~MessageAttachment(); | 31 virtual ~MessageAttachment(); |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(MessageAttachment); |
28 }; | 34 }; |
29 | 35 |
30 } // namespace IPC | 36 } // namespace IPC |
31 | 37 |
32 #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ | 38 #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ |
OLD | NEW |