Chromium Code Reviews| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 PP_Bool uses_nonsfi_mode, | 295 PP_Bool uses_nonsfi_mode, |
| 296 PP_Bool enable_ppapi_dev, | 296 PP_Bool enable_ppapi_dev, |
| 297 PP_Bool enable_dyncode_syscalls, | 297 PP_Bool enable_dyncode_syscalls, |
| 298 PP_Bool enable_exception_handling, | 298 PP_Bool enable_exception_handling, |
| 299 PP_Bool enable_crash_throttling, | 299 PP_Bool enable_crash_throttling, |
| 300 void* imc_handle, | 300 void* imc_handle, |
| 301 PP_CompletionCallback callback) { | 301 PP_CompletionCallback callback) { |
| 302 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> | 302 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> |
| 303 BelongsToCurrentThread()); | 303 BelongsToCurrentThread()); |
| 304 | 304 |
| 305 // FIXME: Remove this. | |
|
bbudge
2014/06/30 18:28:53
Remove this.
teravest
2014/06/30 22:04:56
Done.
| |
| 306 // base::PlatformFileInfo info; | |
| 307 // CHECK(GetPlatformFileInfo(nexe_file_info->handle, &info)); | |
| 308 | |
| 305 // Create the manifest service proxy here, so on error case, it will be | 309 // Create the manifest service proxy here, so on error case, it will be |
| 306 // destructed (without passing it to ManifestServiceChannel). | 310 // destructed (without passing it to ManifestServiceChannel). |
| 307 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy( | 311 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy( |
| 308 new ManifestServiceProxy(instance)); | 312 new ManifestServiceProxy(instance)); |
| 309 | 313 |
| 310 FileDescriptor result_socket; | 314 FileDescriptor result_socket; |
| 311 IPC::Sender* sender = content::RenderThread::Get(); | 315 IPC::Sender* sender = content::RenderThread::Get(); |
| 312 DCHECK(sender); | 316 DCHECK(sender); |
| 313 int routing_id = 0; | 317 int routing_id = 0; |
| 314 // If the nexe uses ppapi APIs, we need a routing ID. | 318 // If the nexe uses ppapi APIs, we need a routing ID. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 336 // Conditionally block 'Dev' interfaces. We do this for the NaCl process, so | 340 // 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 | 341 // it's clearer to developers when they are using 'Dev' inappropriately. We |
| 338 // must also check on the trusted side of the proxy. | 342 // must also check on the trusted side of the proxy. |
| 339 if (enable_ppapi_dev) | 343 if (enable_ppapi_dev) |
| 340 perm_bits |= ppapi::PERMISSION_DEV; | 344 perm_bits |= ppapi::PERMISSION_DEV; |
| 341 instance_info.permissions = | 345 instance_info.permissions = |
| 342 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); | 346 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); |
| 343 std::string error_message_string; | 347 std::string error_message_string; |
| 344 NaClLaunchResult launch_result; | 348 NaClLaunchResult launch_result; |
| 345 | 349 |
| 346 content::RendererPpapiHost* host = | 350 IPC::PlatformFileForTransit nexe_for_transit; |
| 347 content::RendererPpapiHost::GetForPPInstance(instance); | 351 #if defined(OS_POSIX) |
| 352 if (nexe_file_info->handle != PP_kInvalidFileHandle) | |
|
Mark Seaborn
2014/06/30 20:01:03
If this is false, I think it leaves nexe_for_trans
teravest
2014/06/30 22:04:56
Done.
| |
| 353 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); | |
| 354 #else | |
|
bbudge
2014/06/30 18:28:53
nit: #elif defined(OS_WIN)
teravest
2014/06/30 22:04:56
Done.
| |
| 355 // Handle duplication is handled on the browser side instead of the renderer. | |
|
bbudge
2014/06/30 18:28:53
nit wording
// Duplicate the handle on the browser
teravest
2014/06/30 22:04:56
Done.
| |
| 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 #endif | |
| 348 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 360 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
| 349 NaClLaunchParams( | 361 NaClLaunchParams( |
| 350 instance_info.url.spec(), | 362 instance_info.url.spec(), |
| 351 host->ShareHandleWithRemote(nexe_file_info->handle, true), | 363 nexe_for_transit, |
| 364 nexe_file_info->token_lo, | |
| 365 nexe_file_info->token_hi, | |
| 352 routing_id, | 366 routing_id, |
| 353 perm_bits, | 367 perm_bits, |
| 354 PP_ToBool(uses_irt), | 368 PP_ToBool(uses_irt), |
| 355 PP_ToBool(uses_nonsfi_mode), | 369 PP_ToBool(uses_nonsfi_mode), |
| 356 PP_ToBool(enable_dyncode_syscalls), | 370 PP_ToBool(enable_dyncode_syscalls), |
| 357 PP_ToBool(enable_exception_handling), | 371 PP_ToBool(enable_exception_handling), |
| 358 PP_ToBool(enable_crash_throttling)), | 372 PP_ToBool(enable_crash_throttling)), |
| 359 &launch_result, | 373 &launch_result, |
| 360 &error_message_string))) { | 374 &error_message_string))) { |
| 361 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 375 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1624 &SetPNaClStartTime | 1638 &SetPNaClStartTime |
| 1625 }; | 1639 }; |
| 1626 | 1640 |
| 1627 } // namespace | 1641 } // namespace |
| 1628 | 1642 |
| 1629 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1643 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1630 return &nacl_interface; | 1644 return &nacl_interface; |
| 1631 } | 1645 } |
| 1632 | 1646 |
| 1633 } // namespace nacl | 1647 } // namespace nacl |
| OLD | NEW |