| 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 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 #endif | 137 #endif |
| 138 | 138 |
| 139 Message::NextMessageInfo::NextMessageInfo() | 139 Message::NextMessageInfo::NextMessageInfo() |
| 140 : message_size(0), message_found(false), pickle_end(nullptr), | 140 : message_size(0), message_found(false), pickle_end(nullptr), |
| 141 message_end(nullptr) {} | 141 message_end(nullptr) {} |
| 142 Message::NextMessageInfo::~NextMessageInfo() {} | 142 Message::NextMessageInfo::~NextMessageInfo() {} |
| 143 | 143 |
| 144 Message::SerializedAttachmentIds | 144 Message::SerializedAttachmentIds |
| 145 Message::SerializedIdsOfBrokerableAttachments() { | 145 Message::SerializedIdsOfBrokerableAttachments() { |
| 146 DCHECK(HasBrokerableAttachments()); | 146 DCHECK(HasBrokerableAttachments()); |
| 147 std::vector<const BrokerableAttachment*> attachments = | 147 std::vector<BrokerableAttachment*> attachments = |
| 148 attachment_set_->PeekBrokerableAttachments(); | 148 attachment_set_->GetBrokerableAttachments(); |
| 149 CHECK_LE(attachments.size(), std::numeric_limits<size_t>::max() / | 149 CHECK_LE(attachments.size(), std::numeric_limits<size_t>::max() / |
| 150 BrokerableAttachment::kNonceSize); | 150 BrokerableAttachment::kNonceSize); |
| 151 size_t size = attachments.size() * BrokerableAttachment::kNonceSize; | 151 size_t size = attachments.size() * BrokerableAttachment::kNonceSize; |
| 152 char* buffer = static_cast<char*>(malloc(size)); | 152 char* buffer = static_cast<char*>(malloc(size)); |
| 153 for (size_t i = 0; i < attachments.size(); ++i) { | 153 for (size_t i = 0; i < attachments.size(); ++i) { |
| 154 const BrokerableAttachment* attachment = attachments[i]; | 154 const BrokerableAttachment* attachment = attachments[i]; |
| 155 char* start_range = buffer + i * BrokerableAttachment::kNonceSize; | 155 char* start_range = buffer + i * BrokerableAttachment::kNonceSize; |
| 156 BrokerableAttachment::AttachmentId id = attachment->GetIdentifier(); | 156 BrokerableAttachment::AttachmentId id = attachment->GetIdentifier(); |
| 157 id.SerializeToBuffer(start_range, BrokerableAttachment::kNonceSize); | 157 id.SerializeToBuffer(start_range, BrokerableAttachment::kNonceSize); |
| 158 } | 158 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bool Message::HasMojoHandles() const { | 265 bool Message::HasMojoHandles() const { |
| 266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; | 266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; |
| 267 } | 267 } |
| 268 | 268 |
| 269 bool Message::HasBrokerableAttachments() const { | 269 bool Message::HasBrokerableAttachments() const { |
| 270 return attachment_set_.get() && | 270 return attachment_set_.get() && |
| 271 attachment_set_->num_brokerable_attachments() > 0; | 271 attachment_set_->num_brokerable_attachments() > 0; |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace IPC | 274 } // namespace IPC |
| OLD | NEW |