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

Unified Diff: components/nacl/loader/nacl_listener.cc

Issue 1094653003: Refactor NaClProcessHost. Reduce chances to leak the resource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/nacl/loader/nacl_listener.cc
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 4a58a1ce49bcd8a2814fab35a611bdf91ecd2028..56bb8d419911c0743126dc712f4a4a0168f9484f 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -337,7 +337,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
manifest_service_handle)))
LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost.";
- std::vector<nacl::FileDescriptor> handles = params.handles;
+ std::vector<IPC::PlatformFileForTransit> handles = params.handles;
struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
if (args == NULL) {
LOG(ERROR) << "NaClChromeMainArgsCreate() failed";
@@ -348,15 +348,16 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
args->number_of_cores = number_of_cores_;
args->create_memory_object_func = CreateMemoryObject;
# if defined(OS_MACOSX)
- CHECK(handles.size() >= 1);
- g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]);
+ CHECK(!handles.empty());
+ g_shm_fd = IPC::PlatformFileForTransitToPlatformFile(handles.back());
handles.pop_back();
# endif
#endif
DCHECK(params.process_type != nacl::kUnknownNaClProcessType);
- CHECK(handles.size() >= 1);
- NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]);
+ CHECK(!handles.empty());
+ NaClHandle irt_handle =
+ IPC::PlatformFileForTransitToPlatformFile(handles.back());
handles.pop_back();
#if defined(OS_WIN)
@@ -380,7 +381,8 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
}
CHECK(handles.size() == 1);
- args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]);
+ args->imc_bootstrap_handle =
+ IPC::PlatformFileForTransitToPlatformFile(handles[0]);
args->enable_debug_stub = params.enable_debug_stub;
// Now configure parts that depend on process type.
@@ -411,8 +413,9 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
}
#if defined(OS_LINUX) || defined(OS_MACOSX)
- args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle(
- params.debug_stub_server_bound_socket);
+ args->debug_stub_server_bound_socket_fd =
+ IPC::PlatformFileForTransitToPlatformFile(
+ params.debug_stub_server_bound_socket);
#endif
#if defined(OS_WIN)
args->broker_duplicate_handle_func = BrokerDuplicateHandle;

Powered by Google App Engine
This is Rietveld 408576698