Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/nacl/nacl_listener.h" | 5 #include "chrome/nacl/nacl_listener.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 CHECK(handles.size() >= 1); | 231 CHECK(handles.size() >= 1); |
| 232 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 232 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
| 233 handles.pop_back(); | 233 handles.pop_back(); |
| 234 # endif | 234 # endif |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 CHECK(handles.size() >= 1); | 237 CHECK(handles.size() >= 1); |
| 238 NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]); | 238 NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]); |
| 239 handles.pop_back(); | 239 handles.pop_back(); |
| 240 | 240 |
| 241 if (params.uses_irt) { | |
| 241 #if defined(OS_WIN) | 242 #if defined(OS_WIN) |
| 242 args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle), | 243 args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle), |
| 243 _O_RDONLY | _O_BINARY); | 244 _O_RDONLY | _O_BINARY); |
| 244 if (args->irt_fd < 0) { | 245 if (args->irt_fd < 0) { |
| 245 LOG(ERROR) << "_open_osfhandle() failed"; | 246 LOG(ERROR) << "_open_osfhandle() failed"; |
| 246 return; | 247 return; |
| 248 } | |
| 249 #else | |
| 250 args->irt_fd = irt_handle; | |
| 251 #endif | |
| 252 } else { | |
| 253 args->irt_fd = -1; | |
|
Mark Seaborn
2013/01/04 00:05:41
Maybe comment that the IRT FD/handle remains open
jvoung (off chromium)
2013/01/04 00:29:42
Or how about avoid sending the handle in the first
| |
| 247 } | 254 } |
| 248 #else | |
| 249 args->irt_fd = irt_handle; | |
| 250 #endif | |
| 251 | 255 |
| 252 if (params.validation_cache_enabled) { | 256 if (params.validation_cache_enabled) { |
| 253 // SHA256 block size. | 257 // SHA256 block size. |
| 254 CHECK_EQ(params.validation_cache_key.length(), (size_t) 64); | 258 CHECK_EQ(params.validation_cache_key.length(), (size_t) 64); |
| 255 // The cache structure is not freed and exists until the NaCl process exits. | 259 // The cache structure is not freed and exists until the NaCl process exits. |
| 256 args->validation_cache = CreateValidationCache( | 260 args->validation_cache = CreateValidationCache( |
| 257 new BrowserValidationDBProxy(this), params.validation_cache_key, | 261 new BrowserValidationDBProxy(this), params.validation_cache_key, |
| 258 params.version); | 262 params.version); |
| 259 } | 263 } |
| 260 | 264 |
| 261 CHECK(handles.size() == 1); | 265 CHECK(handles.size() == 1); |
| 262 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); | 266 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); |
| 263 args->enable_exception_handling = params.enable_exception_handling; | 267 args->enable_exception_handling = params.enable_exception_handling; |
| 264 args->enable_debug_stub = params.enable_debug_stub; | 268 args->enable_debug_stub = params.enable_debug_stub; |
| 265 #if defined(OS_LINUX) || defined(OS_MACOSX) | 269 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| 266 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( | 270 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( |
| 267 params.debug_stub_server_bound_socket); | 271 params.debug_stub_server_bound_socket); |
| 268 #endif | 272 #endif |
| 269 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
| 270 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 274 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
| 271 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 275 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
| 272 #endif | 276 #endif |
| 273 #if defined(OS_LINUX) | 277 #if defined(OS_LINUX) |
| 274 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 278 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
| 275 #endif | 279 #endif |
| 276 NaClChromeMainStart(args); | 280 NaClChromeMainStart(args); |
| 277 NOTREACHED(); | 281 NOTREACHED(); |
| 278 } | 282 } |
| OLD | NEW |