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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (load_manager->DevInterfacesEnabled()) | 414 if (load_manager->DevInterfacesEnabled()) |
415 perm_bits |= ppapi::PERMISSION_DEV; | 415 perm_bits |= ppapi::PERMISSION_DEV; |
416 instance_info.permissions = | 416 instance_info.permissions = |
417 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); | 417 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); |
418 std::string error_message_string; | 418 std::string error_message_string; |
419 NaClLaunchResult launch_result; | 419 NaClLaunchResult launch_result; |
420 | 420 |
421 IPC::PlatformFileForTransit nexe_for_transit = | 421 IPC::PlatformFileForTransit nexe_for_transit = |
422 IPC::InvalidPlatformFileForTransit(); | 422 IPC::InvalidPlatformFileForTransit(); |
423 | 423 |
424 base::StringPairs resource_files_to_prefetch; | 424 std::vector<NaClResourcePrefetchRequest> resource_prefetch_request_list; |
425 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) { | 425 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) { |
426 JsonManifest* manifest = GetJsonManifest(instance); | 426 JsonManifest* manifest = GetJsonManifest(instance); |
427 if (manifest) | 427 if (manifest) { |
428 manifest->GetPrefetchableFiles(&resource_files_to_prefetch); | 428 manifest->GetPrefetchableFiles(&resource_prefetch_request_list); |
429 for (size_t i = 0; i < resource_files_to_prefetch.size(); ++i) { | 429 |
430 const GURL gurl(resource_files_to_prefetch[i].second); | 430 for (size_t i = 0; i < resource_prefetch_request_list.size(); ++i) { |
431 // Important security check. Do not remove. | 431 const GURL gurl(resource_prefetch_request_list[i].resource_url); |
432 if (!CanOpenViaFastPath(plugin_instance, gurl)) { | 432 // Important security check. Do not remove. |
433 resource_files_to_prefetch.clear(); | 433 if (!CanOpenViaFastPath(plugin_instance, gurl)) { |
434 break; | 434 resource_prefetch_request_list.clear(); |
| 435 break; |
| 436 } |
435 } | 437 } |
436 } | 438 } |
437 } | 439 } |
438 | 440 |
439 #if defined(OS_POSIX) | 441 #if defined(OS_POSIX) |
440 if (nexe_file_info->handle != PP_kInvalidFileHandle) | 442 if (nexe_file_info->handle != PP_kInvalidFileHandle) |
441 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); | 443 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
442 #elif defined(OS_WIN) | 444 #elif defined(OS_WIN) |
443 // Duplicate the handle on the browser side instead of the renderer. | 445 // Duplicate the handle on the browser side instead of the renderer. |
444 // This is because BrokerGetFileForProcess isn't part of content/public, and | 446 // This is because BrokerGetFileForProcess isn't part of content/public, and |
445 // it's simpler to do the duplication in the browser anyway. | 447 // it's simpler to do the duplication in the browser anyway. |
446 nexe_for_transit = nexe_file_info->handle; | 448 nexe_for_transit = nexe_file_info->handle; |
447 #else | 449 #else |
448 #error Unsupported target platform. | 450 #error Unsupported target platform. |
449 #endif | 451 #endif |
450 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 452 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
451 NaClLaunchParams( | 453 NaClLaunchParams( |
452 instance_info.url.spec(), | 454 instance_info.url.spec(), |
453 nexe_for_transit, | 455 nexe_for_transit, |
454 nexe_file_info->token_lo, | 456 nexe_file_info->token_lo, |
455 nexe_file_info->token_hi, | 457 nexe_file_info->token_hi, |
456 resource_files_to_prefetch, | 458 resource_prefetch_request_list, |
457 routing_id, | 459 routing_id, |
458 perm_bits, | 460 perm_bits, |
459 PP_ToBool(uses_nonsfi_mode), | 461 PP_ToBool(uses_nonsfi_mode), |
460 process_type), | 462 process_type), |
461 &launch_result, | 463 &launch_result, |
462 &error_message_string))) { | 464 &error_message_string))) { |
463 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 465 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
464 FROM_HERE, | 466 FROM_HERE, |
465 base::Bind(callback.func, callback.user_data, | 467 base::Bind(callback.func, callback.user_data, |
466 static_cast<int32_t>(PP_ERROR_FAILED))); | 468 static_cast<int32_t>(PP_ERROR_FAILED))); |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 &StreamPexe | 1709 &StreamPexe |
1708 }; | 1710 }; |
1709 | 1711 |
1710 } // namespace | 1712 } // namespace |
1711 | 1713 |
1712 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1714 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1713 return &nacl_interface; | 1715 return &nacl_interface; |
1714 } | 1716 } |
1715 | 1717 |
1716 } // namespace nacl | 1718 } // namespace nacl |
OLD | NEW |