| 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 <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 struct NaClApp* nap = NULL; | 282 struct NaClApp* nap = NULL; |
| 283 NaClChromeMainInit(); | 283 NaClChromeMainInit(); |
| 284 nap = NaClAppCreate(); | 284 nap = NaClAppCreate(); |
| 285 if (nap == NULL) { | 285 if (nap == NULL) { |
| 286 LOG(ERROR) << "NaClAppCreate() failed"; | 286 LOG(ERROR) << "NaClAppCreate() failed"; |
| 287 return; | 287 return; |
| 288 } | 288 } |
| 289 | 289 |
| 290 IPC::ChannelHandle browser_handle; | 290 IPC::ChannelHandle browser_handle; |
| 291 IPC::ChannelHandle ppapi_renderer_handle; | 291 IPC::ChannelHandle ppapi_renderer_handle; |
| 292 IPC::ChannelHandle manifest_service_handle; |
| 292 | 293 |
| 293 if (params.enable_ipc_proxy) { | 294 if (params.enable_ipc_proxy) { |
| 294 browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); | 295 browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); |
| 295 ppapi_renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); | 296 ppapi_renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); |
| 297 manifest_service_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); |
| 296 | 298 |
| 297 // Create the PPAPI IPC channels between the NaCl IRT and the host | 299 // Create the PPAPI IPC channels between the NaCl IRT and the host |
| 298 // (browser/renderer) processes. The IRT uses these channels to | 300 // (browser/renderer) processes. The IRT uses these channels to |
| 299 // communicate with the host and to initialize the IPC dispatchers. | 301 // communicate with the host and to initialize the IPC dispatchers. |
| 300 SetUpIPCAdapter(&browser_handle, io_thread_.message_loop_proxy(), | 302 SetUpIPCAdapter(&browser_handle, io_thread_.message_loop_proxy(), |
| 301 nap, NACL_CHROME_DESC_BASE); | 303 nap, NACL_CHROME_DESC_BASE); |
| 302 SetUpIPCAdapter(&ppapi_renderer_handle, io_thread_.message_loop_proxy(), | 304 SetUpIPCAdapter(&ppapi_renderer_handle, io_thread_.message_loop_proxy(), |
| 303 nap, NACL_CHROME_DESC_BASE + 1); | 305 nap, NACL_CHROME_DESC_BASE + 1); |
| 306 SetUpIPCAdapter(&manifest_service_handle, io_thread_.message_loop_proxy(), |
| 307 nap, NACL_CHROME_DESC_BASE + 2); |
| 304 } | 308 } |
| 305 | 309 |
| 306 IPC::ChannelHandle trusted_renderer_handle = CreateTrustedListener( | 310 IPC::ChannelHandle trusted_renderer_handle = CreateTrustedListener( |
| 307 io_thread_.message_loop_proxy(), &shutdown_event_); | 311 io_thread_.message_loop_proxy(), &shutdown_event_); |
| 308 if (!Send(new NaClProcessHostMsg_PpapiChannelsCreated( | 312 if (!Send(new NaClProcessHostMsg_PpapiChannelsCreated( |
| 309 browser_handle, ppapi_renderer_handle, | 313 browser_handle, ppapi_renderer_handle, |
| 310 trusted_renderer_handle, IPC::ChannelHandle()))) | 314 trusted_renderer_handle, manifest_service_handle))) |
| 311 LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost."; | 315 LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost."; |
| 312 | 316 |
| 313 std::vector<nacl::FileDescriptor> handles = params.handles; | 317 std::vector<nacl::FileDescriptor> handles = params.handles; |
| 314 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate(); | 318 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate(); |
| 315 if (args == NULL) { | 319 if (args == NULL) { |
| 316 LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; | 320 LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; |
| 317 return; | 321 return; |
| 318 } | 322 } |
| 319 | 323 |
| 320 #if defined(OS_LINUX) || defined(OS_MACOSX) | 324 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 IPC::ChannelHandle trusted_renderer_handle = | 508 IPC::ChannelHandle trusted_renderer_handle = |
| 505 IPC::Channel::GenerateVerifiedChannelID("nacl"); | 509 IPC::Channel::GenerateVerifiedChannelID("nacl"); |
| 506 trusted_listener_ = new NaClTrustedListener( | 510 trusted_listener_ = new NaClTrustedListener( |
| 507 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); | 511 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); |
| 508 #if defined(OS_POSIX) | 512 #if defined(OS_POSIX) |
| 509 trusted_renderer_handle.socket = base::FileDescriptor( | 513 trusted_renderer_handle.socket = base::FileDescriptor( |
| 510 trusted_listener_->TakeClientFileDescriptor(), true); | 514 trusted_listener_->TakeClientFileDescriptor(), true); |
| 511 #endif | 515 #endif |
| 512 return trusted_renderer_handle; | 516 return trusted_renderer_handle; |
| 513 } | 517 } |
| OLD | NEW |