OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHANNEL_READER_H_ | 5 #ifndef IPC_IPC_CHANNEL_READER_H_ |
6 #define IPC_IPC_CHANNEL_READER_H_ | 6 #define IPC_IPC_CHANNEL_READER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 // Handles internal messages, like the hello message sent on channel startup. | 108 // Handles internal messages, like the hello message sent on channel startup. |
109 virtual void HandleInternalMessage(const Message& msg) = 0; | 109 virtual void HandleInternalMessage(const Message& msg) = 0; |
110 | 110 |
111 // Exposed for testing purposes only. | 111 // Exposed for testing purposes only. |
112 ScopedVector<Message>* get_queued_messages() { return &queued_messages_; } | 112 ScopedVector<Message>* get_queued_messages() { return &queued_messages_; } |
113 | 113 |
114 // Exposed for testing purposes only. | 114 // Exposed for testing purposes only. |
115 virtual void DispatchMessage(Message* m); | 115 virtual void DispatchMessage(Message* m); |
116 | 116 |
| 117 // Get the process ID for the sender of the message. |
| 118 virtual base::ProcessId GetSenderPID() = 0; |
| 119 |
117 private: | 120 private: |
118 FRIEND_TEST_ALL_PREFIXES(ChannelReaderTest, AttachmentAlreadyBrokered); | 121 FRIEND_TEST_ALL_PREFIXES(ChannelReaderTest, AttachmentAlreadyBrokered); |
119 FRIEND_TEST_ALL_PREFIXES(ChannelReaderTest, AttachmentNotYetBrokered); | 122 FRIEND_TEST_ALL_PREFIXES(ChannelReaderTest, AttachmentNotYetBrokered); |
120 | 123 |
121 typedef std::set<BrokerableAttachment::AttachmentId> AttachmentIdSet; | 124 typedef std::set<BrokerableAttachment::AttachmentId> AttachmentIdSet; |
122 | 125 |
123 // Takes the given data received from the IPC channel, translates it into | 126 // Takes the given data received from the IPC channel, translates it into |
124 // Messages, and puts them in queued_messages_. | 127 // Messages, and puts them in queued_messages_. |
125 // As an optimization, after a message is translated, the message is | 128 // As an optimization, after a message is translated, the message is |
126 // immediately dispatched if able. This prevents an otherwise unnecessary deep | 129 // immediately dispatched if able. This prevents an otherwise unnecessary deep |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // set contains the AttachmentIds that are needed to unblock the message. | 168 // set contains the AttachmentIds that are needed to unblock the message. |
166 AttachmentIdSet blocked_ids_; | 169 AttachmentIdSet blocked_ids_; |
167 | 170 |
168 DISALLOW_COPY_AND_ASSIGN(ChannelReader); | 171 DISALLOW_COPY_AND_ASSIGN(ChannelReader); |
169 }; | 172 }; |
170 | 173 |
171 } // namespace internal | 174 } // namespace internal |
172 } // namespace IPC | 175 } // namespace IPC |
173 | 176 |
174 #endif // IPC_IPC_CHANNEL_READER_H_ | 177 #endif // IPC_IPC_CHANNEL_READER_H_ |
OLD | NEW |