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 IPC::InvalidPlatformFileForTransit(); |
| 348 #if defined(OS_POSIX) |
| 349 if (nexe_file_info->handle != PP_kInvalidFileHandle) |
| 350 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
| 351 #elif defined(OS_WIN) |
| 352 // Duplicate the handle on the browser side instead of the renderer. |
| 353 // This is because BrokerGetFileForProcess isn't part of content/public, and |
| 354 // it's simpler to do the duplication in the browser anyway. |
| 355 nexe_for_transit = nexe_file_info->handle; |
| 356 #else |
| 357 #error Unsupported target platform. |
| 358 #endif |
348 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 359 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
349 NaClLaunchParams( | 360 NaClLaunchParams( |
350 instance_info.url.spec(), | 361 instance_info.url.spec(), |
351 host->ShareHandleWithRemote(nexe_file_info->handle, true), | 362 nexe_for_transit, |
| 363 nexe_file_info->token_lo, |
| 364 nexe_file_info->token_hi, |
352 routing_id, | 365 routing_id, |
353 perm_bits, | 366 perm_bits, |
354 PP_ToBool(uses_irt), | 367 PP_ToBool(uses_irt), |
355 PP_ToBool(uses_nonsfi_mode), | 368 PP_ToBool(uses_nonsfi_mode), |
356 PP_ToBool(enable_dyncode_syscalls), | 369 PP_ToBool(enable_dyncode_syscalls), |
357 PP_ToBool(enable_exception_handling), | 370 PP_ToBool(enable_exception_handling), |
358 PP_ToBool(enable_crash_throttling)), | 371 PP_ToBool(enable_crash_throttling)), |
359 &launch_result, | 372 &launch_result, |
360 &error_message_string))) { | 373 &error_message_string))) { |
361 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 374 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 &SetPNaClStartTime | 1650 &SetPNaClStartTime |
1638 }; | 1651 }; |
1639 | 1652 |
1640 } // namespace | 1653 } // namespace |
1641 | 1654 |
1642 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1655 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1643 return &nacl_interface; | 1656 return &nacl_interface; |
1644 } | 1657 } |
1645 | 1658 |
1646 } // namespace nacl | 1659 } // namespace nacl |
OLD | NEW |