| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_ipc_adapter.h" | 5 #include "components/nacl/loader/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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 508 |
| 509 // Length of the message not including the body. The data passed to us by the | 509 // Length of the message not including the body. The data passed to us by the |
| 510 // plugin should match that in the message header. This should have already | 510 // plugin should match that in the message header. This should have already |
| 511 // been validated by GetBufferStatus. | 511 // been validated by GetBufferStatus. |
| 512 int body_len = static_cast<int>(buffer_len - sizeof(NaClMessageHeader)); | 512 int body_len = static_cast<int>(buffer_len - sizeof(NaClMessageHeader)); |
| 513 DCHECK(body_len == static_cast<int>(header->payload_size)); | 513 DCHECK(body_len == static_cast<int>(header->payload_size)); |
| 514 | 514 |
| 515 // We actually discard the flags and only copy the ones we care about. This | 515 // We actually discard the flags and only copy the ones we care about. This |
| 516 // is just because message doesn't have a constructor that takes raw flags. | 516 // is just because message doesn't have a constructor that takes raw flags. |
| 517 scoped_ptr<IPC::Message> msg( | 517 scoped_ptr<IPC::Message> msg( |
| 518 new IPC::Message(header->routing, header->type, | 518 new IPC::Message(header->routing, header->type)); |
| 519 IPC::Message::PRIORITY_NORMAL)); | |
| 520 if (header->flags & IPC::Message::SYNC_BIT) | 519 if (header->flags & IPC::Message::SYNC_BIT) |
| 521 msg->set_sync(); | 520 msg->set_sync(); |
| 522 if (header->flags & IPC::Message::REPLY_BIT) | 521 if (header->flags & IPC::Message::REPLY_BIT) |
| 523 msg->set_reply(); | 522 msg->set_reply(); |
| 524 if (header->flags & IPC::Message::REPLY_ERROR_BIT) | 523 if (header->flags & IPC::Message::REPLY_ERROR_BIT) |
| 525 msg->set_reply_error(); | 524 msg->set_reply_error(); |
| 526 if (header->flags & IPC::Message::UNBLOCK_BIT) | 525 if (header->flags & IPC::Message::UNBLOCK_BIT) |
| 527 msg->set_unblock(true); | 526 msg->set_unblock(true); |
| 528 | 527 |
| 529 msg->WriteBytes(&buffer[sizeof(NaClMessageHeader)], body_len); | 528 msg->WriteBytes(&buffer[sizeof(NaClMessageHeader)], body_len); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 header.flags = msg.flags(); | 582 header.flags = msg.flags(); |
| 584 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 583 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); |
| 585 | 584 |
| 586 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 585 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 587 locked_data_.to_be_received_.push(rewritten_msg); | 586 locked_data_.to_be_received_.push(rewritten_msg); |
| 588 } | 587 } |
| 589 | 588 |
| 590 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 589 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
| 591 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 590 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
| 592 } | 591 } |
| OLD | NEW |