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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 std::vector<const BrokerableAttachment*> output; | 136 std::vector<const 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 std::vector<scoped_refptr<BrokerableAttachment>> |
| 147 MessageAttachmentSet::GetBrokerableAttachmentsForUpdating() { |
| 148 std::vector<scoped_refptr<BrokerableAttachment>> output; |
| 149 for (const scoped_refptr<MessageAttachment>& attachment : attachments_) { |
| 150 if (attachment->GetType() == |
| 151 MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) { |
| 152 output.push_back(scoped_refptr<BrokerableAttachment>( |
| 153 static_cast<BrokerableAttachment*>(attachment.get()))); |
| 154 } |
| 155 } |
| 156 return output; |
| 157 } |
| 158 |
146 #if defined(OS_POSIX) | 159 #if defined(OS_POSIX) |
147 | 160 |
148 void MessageAttachmentSet::PeekDescriptors(base::PlatformFile* buffer) const { | 161 void MessageAttachmentSet::PeekDescriptors(base::PlatformFile* buffer) const { |
149 for (size_t i = 0; i != attachments_.size(); ++i) | 162 for (size_t i = 0; i != attachments_.size(); ++i) |
150 buffer[i] = internal::GetPlatformFile(attachments_[i]); | 163 buffer[i] = internal::GetPlatformFile(attachments_[i]); |
151 } | 164 } |
152 | 165 |
153 bool MessageAttachmentSet::ContainsDirectoryDescriptor() const { | 166 bool MessageAttachmentSet::ContainsDirectoryDescriptor() const { |
154 struct stat st; | 167 struct stat st; |
155 | 168 |
(...skipping 27 matching lines...) Expand all Loading... |
183 for (unsigned i = 0; i < count; ++i) | 196 for (unsigned i = 0; i < count; ++i) |
184 AddAttachment( | 197 AddAttachment( |
185 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i]))); | 198 new internal::PlatformFileAttachment(base::ScopedFD(buffer[i]))); |
186 } | 199 } |
187 | 200 |
188 #endif // OS_POSIX | 201 #endif // OS_POSIX |
189 | 202 |
190 } // namespace IPC | 203 } // namespace IPC |
191 | 204 |
192 | 205 |
OLD | NEW |