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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so | 339 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so |
340 // it's clearer to developers when they are using 'Dev' inappropriately. We | 340 // it's clearer to developers when they are using 'Dev' inappropriately. We |
341 // must also check on the trusted side of the proxy. | 341 // must also check on the trusted side of the proxy. |
342 if (enable_ppapi_dev) | 342 if (enable_ppapi_dev) |
343 perm_bits |= ppapi::PERMISSION_DEV; | 343 perm_bits |= ppapi::PERMISSION_DEV; |
344 instance_info.permissions = | 344 instance_info.permissions = |
345 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); | 345 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); |
346 std::string error_message_string; | 346 std::string error_message_string; |
347 NaClLaunchResult launch_result; | 347 NaClLaunchResult launch_result; |
348 | 348 |
349 content::RendererPpapiHost* host = | 349 IPC::PlatformFileForTransit nexe_for_transit = |
350 content::RendererPpapiHost::GetForPPInstance(instance); | 350 IPC::InvalidPlatformFileForTransit(); |
| 351 #if defined(OS_POSIX) |
| 352 if (nexe_file_info->handle != PP_kInvalidFileHandle) |
| 353 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
| 354 #elif defined(OS_WIN) |
| 355 // Duplicate the handle on the browser side instead of the renderer. |
| 356 // This is because BrokerGetFileForProcess isn't part of content/public, and |
| 357 // it's simpler to do the duplication in the browser anyway. |
| 358 nexe_for_transit = nexe_file_info->handle; |
| 359 #else |
| 360 #error Unsupported target platform. |
| 361 #endif |
351 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 362 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
352 NaClLaunchParams( | 363 NaClLaunchParams( |
353 instance_info.url.spec(), | 364 instance_info.url.spec(), |
354 host->ShareHandleWithRemote(nexe_file_info->handle, true), | 365 nexe_for_transit, |
| 366 nexe_file_info->token_lo, |
| 367 nexe_file_info->token_hi, |
355 routing_id, | 368 routing_id, |
356 perm_bits, | 369 perm_bits, |
357 PP_ToBool(uses_irt), | 370 PP_ToBool(uses_irt), |
358 PP_ToBool(uses_nonsfi_mode), | 371 PP_ToBool(uses_nonsfi_mode), |
359 PP_ToBool(enable_dyncode_syscalls), | 372 PP_ToBool(enable_dyncode_syscalls), |
360 PP_ToBool(enable_exception_handling), | 373 PP_ToBool(enable_exception_handling), |
361 PP_ToBool(enable_crash_throttling)), | 374 PP_ToBool(enable_crash_throttling)), |
362 &launch_result, | 375 &launch_result, |
363 &error_message_string))) { | 376 &error_message_string))) { |
364 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 377 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 &StreamPexe | 1736 &StreamPexe |
1724 }; | 1737 }; |
1725 | 1738 |
1726 } // namespace | 1739 } // namespace |
1727 | 1740 |
1728 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1741 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1729 return &nacl_interface; | 1742 return &nacl_interface; |
1730 } | 1743 } |
1731 | 1744 |
1732 } // namespace nacl | 1745 } // namespace nacl |
OLD | NEW |