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 #include "ipc/ipc_message.h" | 5 #include "ipc/ipc_message.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 bool Message::WriteAttachment( | 243 bool Message::WriteAttachment( |
244 scoped_refptr<base::Pickle::Attachment> attachment) { | 244 scoped_refptr<base::Pickle::Attachment> attachment) { |
245 bool brokerable; | 245 bool brokerable; |
246 size_t index; | 246 size_t index; |
247 bool success = attachment_set()->AddAttachment( | 247 bool success = attachment_set()->AddAttachment( |
248 make_scoped_refptr(static_cast<MessageAttachment*>(attachment.get())), | 248 make_scoped_refptr(static_cast<MessageAttachment*>(attachment.get())), |
249 &index, &brokerable); | 249 &index, &brokerable); |
250 DCHECK(success); | 250 DCHECK(success); |
251 | 251 |
| 252 // NOTE: If you add more data to the pickle, make sure to update |
| 253 // PickleSizer::AddAttachment. |
| 254 |
252 // Write the type of descriptor. | 255 // Write the type of descriptor. |
253 WriteBool(brokerable); | 256 WriteBool(brokerable); |
254 | 257 |
255 // Write the index of the descriptor so that we don't have to | 258 // Write the index of the descriptor so that we don't have to |
256 // keep the current descriptor as extra decoding state when deserialising. | 259 // keep the current descriptor as extra decoding state when deserialising. |
257 WriteInt(static_cast<int>(index)); | 260 WriteInt(static_cast<int>(index)); |
258 | 261 |
259 #if USE_ATTACHMENT_BROKER | 262 #if USE_ATTACHMENT_BROKER |
260 if (brokerable) | 263 if (brokerable) |
261 header()->num_brokered_attachments++; | 264 header()->num_brokered_attachments++; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 bool Message::HasMojoHandles() const { | 296 bool Message::HasMojoHandles() const { |
294 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; | 297 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; |
295 } | 298 } |
296 | 299 |
297 bool Message::HasBrokerableAttachments() const { | 300 bool Message::HasBrokerableAttachments() const { |
298 return attachment_set_.get() && | 301 return attachment_set_.get() && |
299 attachment_set_->num_brokerable_attachments() > 0; | 302 attachment_set_->num_brokerable_attachments() > 0; |
300 } | 303 } |
301 | 304 |
302 } // namespace IPC | 305 } // namespace IPC |
OLD | NEW |