OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ipc/ipc_message_attachment_set.h" | 5 #include "ipc/ipc_message_attachment_set.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
10 #include "ipc/brokerable_attachment.h" | 10 #include "ipc/brokerable_attachment.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 consumed_descriptor_highwater_ = index + 1; | 124 consumed_descriptor_highwater_ = index + 1; |
125 | 125 |
126 return attachments_[index]; | 126 return attachments_[index]; |
127 } | 127 } |
128 | 128 |
129 void MessageAttachmentSet::CommitAll() { | 129 void MessageAttachmentSet::CommitAll() { |
130 attachments_.clear(); | 130 attachments_.clear(); |
131 consumed_descriptor_highwater_ = 0; | 131 consumed_descriptor_highwater_ = 0; |
132 } | 132 } |
133 | 133 |
134 std::vector<const BrokerableAttachment*> | 134 std::vector<BrokerableAttachment*> |
135 MessageAttachmentSet::PeekBrokerableAttachments() const { | 135 MessageAttachmentSet::GetBrokerableAttachments() const { |
136 std::vector<const BrokerableAttachment*> output; | 136 std::vector<BrokerableAttachment*> output; |
137 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) { | 137 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) { |
138 if (attachment->GetType() == | 138 if (attachment->GetType() == |
139 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) { | 139 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) { |
140 output.push_back(static_cast<BrokerableAttachment*>(attachment.get())); | 140 output.push_back(static_cast<BrokerableAttachment*>(attachment.get())); |
141 } | 141 } |
142 } | 142 } |
143 return output; | 143 return output; |
144 } | 144 } |
145 | 145 |
146 void MessageAttachmentSet::ReplacePlaceholderWithAttachment( | 146 void MessageAttachmentSet::ReplacePlaceholderWithAttachment( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 for (unsigned i = 0; i < count; ++i) | 204 for (unsigned i = 0; i < count; ++i) |
205 AddAttachment( | 205 AddAttachment( |
206 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i]))); | 206 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i]))); |
207 } | 207 } |
208 | 208 |
209 #endif // OS_POSIX | 209 #endif // OS_POSIX |
210 | 210 |
211 } // namespace IPC | 211 } // namespace IPC |
212 | 212 |
213 | 213 |
OLD | NEW |