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/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so | 336 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so |
337 // it's clearer to developers when they are using 'Dev' inappropriately. We | 337 // it's clearer to developers when they are using 'Dev' inappropriately. We |
338 // must also check on the trusted side of the proxy. | 338 // must also check on the trusted side of the proxy. |
339 if (enable_ppapi_dev) | 339 if (enable_ppapi_dev) |
340 perm_bits |= ppapi::PERMISSION_DEV; | 340 perm_bits |= ppapi::PERMISSION_DEV; |
341 instance_info.permissions = | 341 instance_info.permissions = |
342 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); | 342 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); |
343 std::string error_message_string; | 343 std::string error_message_string; |
344 NaClLaunchResult launch_result; | 344 NaClLaunchResult launch_result; |
345 | 345 |
346 content::RendererPpapiHost* host = | 346 IPC::PlatformFileForTransit nexe_for_transit; |
347 content::RendererPpapiHost::GetForPPInstance(instance); | 347 #if defined(OS_POSIX) |
| 348 if (nexe_file_info->handle != PP_kInvalidFileHandle) |
| 349 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
| 350 #elif defined(OS_WIN) |
| 351 // Duplicate the handle on the browser side instead of the renderer. |
| 352 // This is because BrokerGetFileForProcess isn't part of content/public, and |
| 353 // it's simpler to do the duplication in the browser anyway. |
| 354 nexe_for_transit = nexe_file_info->handle; |
| 355 #else |
| 356 #error Unsupported target platform. |
| 357 #endif |
348 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 358 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
349 NaClLaunchParams( | 359 NaClLaunchParams( |
350 instance_info.url.spec(), | 360 instance_info.url.spec(), |
351 host->ShareHandleWithRemote(nexe_file_info->handle, true), | 361 nexe_for_transit, |
| 362 nexe_file_info->token_lo, |
| 363 nexe_file_info->token_hi, |
352 routing_id, | 364 routing_id, |
353 perm_bits, | 365 perm_bits, |
354 PP_ToBool(uses_irt), | 366 PP_ToBool(uses_irt), |
355 PP_ToBool(uses_nonsfi_mode), | 367 PP_ToBool(uses_nonsfi_mode), |
356 PP_ToBool(enable_dyncode_syscalls), | 368 PP_ToBool(enable_dyncode_syscalls), |
357 PP_ToBool(enable_exception_handling), | 369 PP_ToBool(enable_exception_handling), |
358 PP_ToBool(enable_crash_throttling)), | 370 PP_ToBool(enable_crash_throttling)), |
359 &launch_result, | 371 &launch_result, |
360 &error_message_string))) { | 372 &error_message_string))) { |
361 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 373 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 &SetPNaClStartTime | 1636 &SetPNaClStartTime |
1625 }; | 1637 }; |
1626 | 1638 |
1627 } // namespace | 1639 } // namespace |
1628 | 1640 |
1629 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1641 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1630 return &nacl_interface; | 1642 return &nacl_interface; |
1631 } | 1643 } |
1632 | 1644 |
1633 } // namespace nacl | 1645 } // namespace nacl |
OLD | NEW |