OLD | NEW |
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 <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 private: | 195 private: |
196 // The listener never dies, otherwise this might be a dangling reference. | 196 // The listener never dies, otherwise this might be a dangling reference. |
197 NaClListener* listener_; | 197 NaClListener* listener_; |
198 }; | 198 }; |
199 | 199 |
200 | 200 |
201 NaClListener::NaClListener() : shutdown_event_(true, false), | 201 NaClListener::NaClListener() : shutdown_event_(true, false), |
202 io_thread_("NaCl_IOThread"), | 202 io_thread_("NaCl_IOThread"), |
203 #if defined(OS_LINUX) | 203 #if defined(OS_LINUX) |
| 204 uses_nonsfi_mode_(false), |
204 prereserved_sandbox_size_(0), | 205 prereserved_sandbox_size_(0), |
205 #endif | 206 #endif |
206 #if defined(OS_POSIX) | 207 #if defined(OS_POSIX) |
207 number_of_cores_(-1), // unknown/error | 208 number_of_cores_(-1), // unknown/error |
208 #endif | 209 #endif |
209 main_loop_(NULL) { | 210 main_loop_(NULL) { |
210 io_thread_.StartWithOptions( | 211 io_thread_.StartWithOptions( |
211 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 212 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
212 #if defined(OS_WIN) | 213 #if defined(OS_WIN) |
213 DCHECK(g_listener == NULL); | 214 DCHECK(g_listener == NULL); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 281 } |
281 | 282 |
282 IPC::ChannelHandle browser_handle; | 283 IPC::ChannelHandle browser_handle; |
283 IPC::ChannelHandle ppapi_renderer_handle; | 284 IPC::ChannelHandle ppapi_renderer_handle; |
284 | 285 |
285 if (params.enable_ipc_proxy) { | 286 if (params.enable_ipc_proxy) { |
286 browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); | 287 browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); |
287 ppapi_renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); | 288 ppapi_renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); |
288 | 289 |
289 #if defined(OS_LINUX) | 290 #if defined(OS_LINUX) |
290 if (params.uses_nonsfi_mode) { | 291 if (uses_nonsfi_mode_) { |
291 // In non-SFI mode, we neither intercept nor rewrite the message using | 292 // In non-SFI mode, we neither intercept nor rewrite the message using |
292 // NaClIPCAdapter, and the channels are connected between the plugin and | 293 // NaClIPCAdapter, and the channels are connected between the plugin and |
293 // the hosts directly. So, the IPC::Channel instances will be created in | 294 // the hosts directly. So, the IPC::Channel instances will be created in |
294 // the plugin side, because the IPC::Listener needs to live on the | 295 // the plugin side, because the IPC::Listener needs to live on the |
295 // plugin's main thread. However, on initialization (i.e. before loading | 296 // plugin's main thread. However, on initialization (i.e. before loading |
296 // the plugin binary), the FD needs to be passed to the hosts. So, here | 297 // the plugin binary), the FD needs to be passed to the hosts. So, here |
297 // we create raw FD pairs, and pass the client side FDs to the hosts, | 298 // we create raw FD pairs, and pass the client side FDs to the hosts, |
298 // and the server side FDs to the plugin. | 299 // and the server side FDs to the plugin. |
299 int browser_server_ppapi_fd; | 300 int browser_server_ppapi_fd; |
300 int browser_client_ppapi_fd; | 301 int browser_client_ppapi_fd; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 #endif | 415 #endif |
415 #if defined(OS_WIN) | 416 #if defined(OS_WIN) |
416 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 417 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
417 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 418 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
418 #endif | 419 #endif |
419 #if defined(OS_LINUX) | 420 #if defined(OS_LINUX) |
420 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 421 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
421 #endif | 422 #endif |
422 | 423 |
423 #if defined(OS_LINUX) | 424 #if defined(OS_LINUX) |
424 if (params.uses_nonsfi_mode) { | 425 if (uses_nonsfi_mode_) { |
425 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); | 426 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); |
426 return; | 427 return; |
427 } | 428 } |
428 #endif | 429 #endif |
429 NaClChromeMainStartApp(nap, args); | 430 NaClChromeMainStartApp(nap, args); |
430 NOTREACHED(); | 431 NOTREACHED(); |
431 } | 432 } |
OLD | NEW |