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_ATTACHMENT_BROKER_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_H_ |
6 #define IPC_ATTACHMENT_BROKER_H_ | 6 #define IPC_ATTACHMENT_BROKER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 const scoped_refptr<BrokerableAttachment>& attachment); | 77 const scoped_refptr<BrokerableAttachment>& attachment); |
78 | 78 |
79 // Informs the observers that a new BrokerableAttachment has been received. | 79 // Informs the observers that a new BrokerableAttachment has been received. |
80 void NotifyObservers(const BrokerableAttachment::AttachmentId& id); | 80 void NotifyObservers(const BrokerableAttachment::AttachmentId& id); |
81 | 81 |
82 // This method is exposed for testing only. | 82 // This method is exposed for testing only. |
83 AttachmentVector* get_attachments() { return &attachments_; } | 83 AttachmentVector* get_attachments() { return &attachments_; } |
84 | 84 |
85 private: | 85 private: |
86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
87 FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerWinTest, ReceiveValidMessage); | 87 FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerUnprivilegedWinTest, |
88 FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerWinTest, ReceiveInvalidMessage); | 88 ReceiveValidMessage); |
| 89 FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerUnprivilegedWinTest, |
| 90 ReceiveInvalidMessage); |
89 #endif // defined(OS_WIN) | 91 #endif // defined(OS_WIN) |
90 | 92 |
91 // A vector of BrokerableAttachments that have been received, but not yet | 93 // A vector of BrokerableAttachments that have been received, but not yet |
92 // consumed. | 94 // consumed. |
93 // A std::vector is used instead of a std::map because this container is | 95 // A std::vector is used instead of a std::map because this container is |
94 // expected to have few elements, for which a std::vector is expected to have | 96 // expected to have few elements, for which a std::vector is expected to have |
95 // better performance. | 97 // better performance. |
96 AttachmentVector attachments_; | 98 AttachmentVector attachments_; |
97 | 99 |
98 std::vector<Observer*> observers_; | 100 std::vector<Observer*> observers_; |
99 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); | 101 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
100 }; | 102 }; |
101 | 103 |
102 } // namespace IPC | 104 } // namespace IPC |
103 | 105 |
104 #endif // IPC_ATTACHMENT_BROKER_H_ | 106 #endif // IPC_ATTACHMENT_BROKER_H_ |
OLD | NEW |