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

Side by Side Diff: components/nacl/loader/nacl_trusted_listener.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_trusted_listener.h" 5 #include "components/nacl/loader/nacl_trusted_listener.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 8
9 NaClTrustedListener::NaClTrustedListener( 9 NaClTrustedListener::NaClTrustedListener(
10 const IPC::ChannelHandle& handle, 10 const IPC::ChannelHandle& handle,
11 base::SingleThreadTaskRunner* ipc_task_runner, 11 base::SingleThreadTaskRunner* ipc_task_runner,
12 base::WaitableEvent* shutdown_event) 12 base::WaitableEvent* shutdown_event)
13 : channel_handle_(handle) { 13 : channel_handle_(handle) {
14 channel_ = IPC::SyncChannel::Create(handle, 14 channel_ = IPC::SyncChannel::Create(handle,
15 IPC::Channel::MODE_SERVER, 15 IPC::Channel::MODE_SERVER,
16 this, 16 this,
17 ipc_task_runner, 17 ipc_task_runner,
18 true, /* create_channel_now */ 18 true, /* create_channel_now */
19 shutdown_event).Pass(); 19 shutdown_event).Pass();
20 } 20 }
21 21
22 NaClTrustedListener::~NaClTrustedListener() { 22 NaClTrustedListener::~NaClTrustedListener() {
23 } 23 }
24 24
25 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() { 25 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() {
26 IPC::ChannelHandle handle = channel_handle_; 26 IPC::ChannelHandle handle = channel_handle_;
27 #if defined(OS_POSIX) 27 #if defined(OS_POSIX)
28 handle.socket = 28 handle.socket =
29 base::FileDescriptor(channel_->TakeClientFileDescriptor(), true); 29 base::FileDescriptor(channel_->TakeClientFileDescriptor());
30 #endif 30 #endif
31 return handle; 31 return handle;
32 } 32 }
33 33
34 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) { 34 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) {
35 return false; 35 return false;
36 } 36 }
37 37
38 void NaClTrustedListener::OnChannelError() { 38 void NaClTrustedListener::OnChannelError() {
39 channel_->Close(); 39 channel_->Close();
40 } 40 }
41 41
42 bool NaClTrustedListener::Send(IPC::Message* msg) { 42 bool NaClTrustedListener::Send(IPC::Message* msg) {
43 return channel_->Send(msg); 43 return channel_->Send(msg);
44 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698