Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: components/nacl/loader/nacl_ipc_adapter.cc

Issue 621613002: Refactoring: Make IPC::Channel::TakeClientFileDescriptor() a ScopedFD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Mac build Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 task_runner_->PostTask(FROM_HERE, 454 task_runner_->PostTask(FROM_HERE,
455 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this)); 455 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this));
456 } 456 }
457 457
458 NaClDesc* NaClIPCAdapter::MakeNaClDesc() { 458 NaClDesc* NaClIPCAdapter::MakeNaClDesc() {
459 return MakeNaClDescCustom(this); 459 return MakeNaClDescCustom(this);
460 } 460 }
461 461
462 #if defined(OS_POSIX) 462 #if defined(OS_POSIX)
463 int NaClIPCAdapter::TakeClientFileDescriptor() { 463 base::ScopedFD NaClIPCAdapter::TakeClientFileDescriptor() {
464 return io_thread_data_.channel_->TakeClientFileDescriptor(); 464 return io_thread_data_.channel_->TakeClientFileDescriptor();
465 } 465 }
466 #endif 466 #endif
467 467
468 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) { 468 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
469 uint32_t type = msg.type(); 469 uint32_t type = msg.type();
470 470
471 if (type == IPC_REPLY_ID) { 471 if (type == IPC_REPLY_ID) {
472 int id = IPC::SyncMessage::GetMessageId(msg); 472 int id = IPC::SyncMessage::GetMessageId(msg);
473 IOThreadData::PendingSyncMsgMap::iterator it = 473 IOThreadData::PendingSyncMsgMap::iterator it =
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 header.flags = msg.flags(); 826 header.flags = msg.flags();
827 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); 827 header.num_fds = static_cast<int>(rewritten_msg->desc_count());
828 828
829 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); 829 rewritten_msg->SetData(header, msg.payload(), msg.payload_size());
830 locked_data_.to_be_received_.push(rewritten_msg); 830 locked_data_.to_be_received_.push(rewritten_msg);
831 } 831 }
832 832
833 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { 833 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) {
834 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); 834 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags);
835 } 835 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698