| 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 "chrome/nacl/nacl_ipc_adapter.h" | 5 #include "chrome/nacl/nacl_ipc_adapter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 nacl_abi_size_t desc_count = static_cast<nacl_abi_size_t>(descs_.size()); | 261 nacl_abi_size_t desc_count = static_cast<nacl_abi_size_t>(descs_.size()); |
| 262 CHECK(desc_count <= msg->ndesc_length); | 262 CHECK(desc_count <= msg->ndesc_length); |
| 263 msg->ndesc_length = desc_count; | 263 msg->ndesc_length = desc_count; |
| 264 for (nacl_abi_size_t i = 0; i < desc_count; i++) { | 264 for (nacl_abi_size_t i = 0; i < desc_count; i++) { |
| 265 // Copy the NaClDesc to the buffer and add a ref so it won't be freed | 265 // Copy the NaClDesc to the buffer and add a ref so it won't be freed |
| 266 // when we clear our ScopedVector. | 266 // when we clear our ScopedVector. |
| 267 msg->ndescv[i] = descs_[i]->desc(); | 267 msg->ndescv[i] = descs_[i]->desc(); |
| 268 NaClDescRef(descs_[i]->desc()); | 268 NaClDescRef(descs_[i]->desc()); |
| 269 } | 269 } |
| 270 descs_.clear(); | 270 descs_.clear(); |
| 271 } else { |
| 272 msg->ndesc_length = 0; |
| 271 } | 273 } |
| 272 return static_cast<int>(bytes_to_write); | 274 return static_cast<int>(bytes_to_write); |
| 273 } | 275 } |
| 274 | 276 |
| 275 NaClIPCAdapter::LockedData::LockedData() | 277 NaClIPCAdapter::LockedData::LockedData() |
| 276 : channel_closed_(false) { | 278 : channel_closed_(false) { |
| 277 } | 279 } |
| 278 | 280 |
| 279 NaClIPCAdapter::LockedData::~LockedData() { | 281 NaClIPCAdapter::LockedData::~LockedData() { |
| 280 } | 282 } |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 header.payload_size = static_cast<uint32>(msg.payload_size()); | 670 header.payload_size = static_cast<uint32>(msg.payload_size()); |
| 669 header.routing = msg.routing_id(); | 671 header.routing = msg.routing_id(); |
| 670 header.type = msg.type(); | 672 header.type = msg.type(); |
| 671 header.flags = msg.flags(); | 673 header.flags = msg.flags(); |
| 672 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 674 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); |
| 673 | 675 |
| 674 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 676 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 675 locked_data_.to_be_received_.push(rewritten_msg); | 677 locked_data_.to_be_received_.push(rewritten_msg); |
| 676 } | 678 } |
| 677 | 679 |
| OLD | NEW |