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 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 IPC::ChannelHandle trusted_renderer_handle = | 492 IPC::ChannelHandle trusted_renderer_handle = |
489 IPC::Channel::GenerateVerifiedChannelID("nacl"); | 493 IPC::Channel::GenerateVerifiedChannelID("nacl"); |
490 trusted_listener_ = new NaClTrustedListener( | 494 trusted_listener_ = new NaClTrustedListener( |
491 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); | 495 trusted_renderer_handle, io_thread_.message_loop_proxy().get()); |
492 #if defined(OS_POSIX) | 496 #if defined(OS_POSIX) |
493 trusted_renderer_handle.socket = base::FileDescriptor( | 497 trusted_renderer_handle.socket = base::FileDescriptor( |
494 trusted_listener_->TakeClientFileDescriptor(), true); | 498 trusted_listener_->TakeClientFileDescriptor(), true); |
495 #endif | 499 #endif |
496 return trusted_renderer_handle; | 500 return trusted_renderer_handle; |
497 } | 501 } |
OLD | NEW |