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 IPC::PlatformFileForTransit nexe_for_transit = | 349 content::RendererPpapiHost* host = |
350 IPC::InvalidPlatformFileForTransit(); | 350 content::RendererPpapiHost::GetForPPInstance(instance); |
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 | |
362 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 351 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
363 NaClLaunchParams( | 352 NaClLaunchParams( |
364 instance_info.url.spec(), | 353 instance_info.url.spec(), |
365 nexe_for_transit, | 354 host->ShareHandleWithRemote(nexe_file_info->handle, true), |
366 nexe_file_info->token_lo, | |
367 nexe_file_info->token_hi, | |
368 routing_id, | 355 routing_id, |
369 perm_bits, | 356 perm_bits, |
370 PP_ToBool(uses_irt), | 357 PP_ToBool(uses_irt), |
371 PP_ToBool(uses_nonsfi_mode), | 358 PP_ToBool(uses_nonsfi_mode), |
372 PP_ToBool(enable_dyncode_syscalls), | 359 PP_ToBool(enable_dyncode_syscalls), |
373 PP_ToBool(enable_exception_handling), | 360 PP_ToBool(enable_exception_handling), |
374 PP_ToBool(enable_crash_throttling)), | 361 PP_ToBool(enable_crash_throttling)), |
375 &launch_result, | 362 &launch_result, |
376 &error_message_string))) { | 363 &error_message_string))) { |
377 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 364 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 &StreamPexe | 1723 &StreamPexe |
1737 }; | 1724 }; |
1738 | 1725 |
1739 } // namespace | 1726 } // namespace |
1740 | 1727 |
1741 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1728 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1742 return &nacl_interface; | 1729 return &nacl_interface; |
1743 } | 1730 } |
1744 | 1731 |
1745 } // namespace nacl | 1732 } // namespace nacl |
OLD | NEW |