OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROKERABLE_ATTACHMENT_H_ | 5 #ifndef IPC_BROKERABLE_ATTACHMENT_H_ |
6 #define IPC_BROKERABLE_ATTACHMENT_H_ | 6 #define IPC_BROKERABLE_ATTACHMENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if (nonce[i] < rhs.nonce[i]) | 44 if (nonce[i] < rhs.nonce[i]) |
45 return true; | 45 return true; |
46 if (nonce[i] > rhs.nonce[i]) | 46 if (nonce[i] > rhs.nonce[i]) |
47 return false; | 47 return false; |
48 } | 48 } |
49 return false; | 49 return false; |
50 } | 50 } |
51 }; | 51 }; |
52 | 52 |
53 enum BrokerableType { | 53 enum BrokerableType { |
| 54 PLACEHOLDER, |
54 WIN_HANDLE, | 55 WIN_HANDLE, |
55 }; | 56 }; |
56 | 57 |
57 // The identifier is unique across all Chrome processes. | 58 // The identifier is unique across all Chrome processes. |
58 AttachmentId GetIdentifier() const; | 59 AttachmentId GetIdentifier() const; |
59 | 60 |
60 // Whether the attachment still needs information from the broker before it | 61 // Whether the attachment still needs information from the broker before it |
61 // can be used. | 62 // can be used. |
62 bool NeedsBrokering() const; | 63 bool NeedsBrokering() const; |
63 | 64 |
64 // Fills in the data of this instance with the data from |attachment|. | |
65 // This instance must require brokering, |attachment| must be brokered, and | |
66 // both instances must have the same identifier. | |
67 virtual void PopulateWithAttachment( | |
68 const BrokerableAttachment* attachment) = 0; | |
69 | |
70 // Returns TYPE_BROKERABLE_ATTACHMENT | 65 // Returns TYPE_BROKERABLE_ATTACHMENT |
71 Type GetType() const override; | 66 Type GetType() const override; |
72 | 67 |
73 virtual BrokerableType GetBrokerableType() const = 0; | 68 virtual BrokerableType GetBrokerableType() const = 0; |
74 | 69 |
| 70 // MessageAttachment override. |
| 71 #if defined(OS_POSIX) |
| 72 base::PlatformFile TakePlatformFile() override; |
| 73 #endif // OS_POSIX |
| 74 |
75 protected: | 75 protected: |
76 BrokerableAttachment(); | 76 BrokerableAttachment(); |
77 BrokerableAttachment(const AttachmentId& id, bool needs_brokering); | 77 BrokerableAttachment(const AttachmentId& id); |
78 ~BrokerableAttachment() override; | 78 ~BrokerableAttachment() override; |
79 | 79 |
80 void SetNeedsBrokering(bool needs_brokering); | |
81 | |
82 private: | 80 private: |
83 // This member uniquely identifies a BrokerableAttachment across all Chrome | 81 // This member uniquely identifies a BrokerableAttachment across all Chrome |
84 // processes. | 82 // processes. |
85 const AttachmentId id_; | 83 const AttachmentId id_; |
86 | 84 |
87 // Whether the attachment still needs to be filled in by an AttachmentBroker. | |
88 bool needs_brokering_; | |
89 DISALLOW_COPY_AND_ASSIGN(BrokerableAttachment); | 85 DISALLOW_COPY_AND_ASSIGN(BrokerableAttachment); |
90 }; | 86 }; |
91 | 87 |
92 } // namespace IPC | 88 } // namespace IPC |
93 | 89 |
94 #endif // IPC_BROKERABLE_ATTACHMENT_H_ | 90 #endif // IPC_BROKERABLE_ATTACHMENT_H_ |
OLD | NEW |