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