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

Side by Side Diff: components/nacl/browser/nacl_process_host.cc

Issue 1862333002: ipc: Rename TakeFileHandleForProcess->TakePlatformFileForTransit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 void NaClProcessHost::StartNaClFileResolved( 987 void NaClProcessHost::StartNaClFileResolved(
988 NaClStartParams params, 988 NaClStartParams params,
989 const base::FilePath& file_path, 989 const base::FilePath& file_path,
990 base::File checked_nexe_file) { 990 base::File checked_nexe_file) {
991 if (checked_nexe_file.IsValid()) { 991 if (checked_nexe_file.IsValid()) {
992 // Release the file received from the renderer. This has to be done on a 992 // Release the file received from the renderer. This has to be done on a
993 // thread where IO is permitted, though. 993 // thread where IO is permitted, though.
994 content::BrowserThread::GetBlockingPool()->PostTask( 994 content::BrowserThread::GetBlockingPool()->PostTask(
995 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(nexe_file_)))); 995 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(nexe_file_))));
996 params.nexe_file_path_metadata = file_path; 996 params.nexe_file_path_metadata = file_path;
997 params.nexe_file = IPC::TakeFileHandleForProcess( 997 params.nexe_file =
998 std::move(checked_nexe_file), process_->GetData().handle); 998 IPC::TakePlatformFileForTransit(std::move(checked_nexe_file));
999 } else { 999 } else {
1000 params.nexe_file = IPC::TakeFileHandleForProcess( 1000 params.nexe_file = IPC::TakePlatformFileForTransit(std::move(nexe_file_));
1001 std::move(nexe_file_), process_->GetData().handle);
1002 } 1001 }
1003 1002
1004 #if defined(OS_LINUX) 1003 #if defined(OS_LINUX)
1005 // In Non-SFI mode, create socket pairs for IPC channels here, unlike in 1004 // In Non-SFI mode, create socket pairs for IPC channels here, unlike in
1006 // SFI-mode, in which those channels are created in nacl_listener.cc. 1005 // SFI-mode, in which those channels are created in nacl_listener.cc.
1007 // This is for security hardening. We can then prohibit the socketpair() 1006 // This is for security hardening. We can then prohibit the socketpair()
1008 // system call in nacl_helper and nacl_helper_nonsfi. 1007 // system call in nacl_helper and nacl_helper_nonsfi.
1009 if (uses_nonsfi_mode_) { 1008 if (uses_nonsfi_mode_) {
1010 // Note: here, because some FDs/handles for the NaCl loader process are 1009 // Note: here, because some FDs/handles for the NaCl loader process are
1011 // already opened, they are transferred to NaCl loader process even if 1010 // already opened, they are transferred to NaCl loader process even if
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1253
1255 void NaClProcessHost::FileResolved( 1254 void NaClProcessHost::FileResolved(
1256 uint64_t file_token_lo, 1255 uint64_t file_token_lo,
1257 uint64_t file_token_hi, 1256 uint64_t file_token_hi,
1258 const base::FilePath& file_path, 1257 const base::FilePath& file_path,
1259 base::File file) { 1258 base::File file) {
1260 base::FilePath out_file_path; 1259 base::FilePath out_file_path;
1261 IPC::PlatformFileForTransit out_handle; 1260 IPC::PlatformFileForTransit out_handle;
1262 if (file.IsValid()) { 1261 if (file.IsValid()) {
1263 out_file_path = file_path; 1262 out_file_path = file_path;
1264 out_handle = IPC::TakeFileHandleForProcess(std::move(file), 1263 out_handle = IPC::TakePlatformFileForTransit(std::move(file));
1265 process_->GetData().handle);
1266 } else { 1264 } else {
1267 out_handle = IPC::InvalidPlatformFileForTransit(); 1265 out_handle = IPC::InvalidPlatformFileForTransit();
1268 } 1266 }
1269 Send(new NaClProcessMsg_ResolveFileTokenReply( 1267 Send(new NaClProcessMsg_ResolveFileTokenReply(
1270 file_token_lo, 1268 file_token_lo,
1271 file_token_hi, 1269 file_token_hi,
1272 out_handle, 1270 out_handle,
1273 out_file_path)); 1271 out_file_path));
1274 } 1272 }
1275 1273
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 NaClStartDebugExceptionHandlerThread( 1335 NaClStartDebugExceptionHandlerThread(
1338 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), 1336 std::move(process), info, base::ThreadTaskRunnerHandle::Get(),
1339 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1337 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1340 weak_factory_.GetWeakPtr())); 1338 weak_factory_.GetWeakPtr()));
1341 return true; 1339 return true;
1342 } 1340 }
1343 } 1341 }
1344 #endif 1342 #endif
1345 1343
1346 } // namespace nacl 1344 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/browser/nacl_host_message_filter.cc ('k') | components/nacl/renderer/manifest_service_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698