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

Side by Side Diff: components/nacl/loader/nacl_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 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_listener.h" 5 #include "components/nacl/loader/nacl_listener.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 scoped_refptr<NaClIPCAdapter> SetUpIPCAdapter( 139 scoped_refptr<NaClIPCAdapter> SetUpIPCAdapter(
140 IPC::ChannelHandle* handle, 140 IPC::ChannelHandle* handle,
141 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 141 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
142 struct NaClApp* nap, 142 struct NaClApp* nap,
143 int nacl_fd) { 143 int nacl_fd) {
144 scoped_refptr<NaClIPCAdapter> ipc_adapter( 144 scoped_refptr<NaClIPCAdapter> ipc_adapter(
145 new NaClIPCAdapter(*handle, message_loop_proxy.get())); 145 new NaClIPCAdapter(*handle, message_loop_proxy.get()));
146 ipc_adapter->ConnectChannel(); 146 ipc_adapter->ConnectChannel();
147 #if defined(OS_POSIX) 147 #if defined(OS_POSIX)
148 handle->socket = 148 handle->socket =
149 base::FileDescriptor(ipc_adapter->TakeClientFileDescriptor(), true); 149 base::FileDescriptor(ipc_adapter->TakeClientFileDescriptor());
150 #endif 150 #endif
151 151
152 // Pass a NaClDesc to the untrusted side. This will hold a ref to the 152 // Pass a NaClDesc to the untrusted side. This will hold a ref to the
153 // NaClIPCAdapter. 153 // NaClIPCAdapter.
154 NaClAppSetDesc(nap, nacl_fd, ipc_adapter->MakeNaClDesc()); 154 NaClAppSetDesc(nap, nacl_fd, ipc_adapter->MakeNaClDesc());
155 return ipc_adapter; 155 return ipc_adapter;
156 } 156 }
157 157
158 } // namespace 158 } // namespace
159 159
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 void NaClListener::OnFileTokenResolved( 493 void NaClListener::OnFileTokenResolved(
494 uint64_t token_lo, 494 uint64_t token_lo,
495 uint64_t token_hi, 495 uint64_t token_hi,
496 IPC::PlatformFileForTransit ipc_fd, 496 IPC::PlatformFileForTransit ipc_fd,
497 base::FilePath file_path) { 497 base::FilePath file_path) {
498 resolved_cb_.Run(ipc_fd, file_path); 498 resolved_cb_.Run(ipc_fd, file_path);
499 resolved_cb_.Reset(); 499 resolved_cb_.Reset();
500 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698