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 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 std::vector<std::pair< | 424 std::vector<NaClResourcePrefetchInfo> resource_prefetch_info_list; |
| 425 std::string /*key*/, std::string /*url*/> > resource_files_to_prefetch; | |
| 426 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) { | 425 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) { |
| 427 JsonManifest* manifest = GetJsonManifest(instance); | 426 JsonManifest* manifest = GetJsonManifest(instance); |
| 428 if (manifest) | 427 if (manifest) { |
| 429 manifest->GetPrefetchableFiles(&resource_files_to_prefetch); | 428 std::vector< |
| 430 for (size_t i = 0; i < resource_files_to_prefetch.size(); ++i) { | 429 std::pair<std::string /*key*/, std::string /*url*/> > candidates; |
| 431 const GURL gurl(resource_files_to_prefetch[i].second); | 430 manifest->GetPrefetchableFiles(&candidates); |
|
Mark Seaborn
2015/04/23 00:10:11
Would it make sense for GetPrefetchableFiles to us
hidehiko
2015/04/23 11:51:29
Done.
| |
| 432 // Important security check. Do not remove. | 431 for (size_t i = 0; i < candidates.size(); ++i) { |
| 433 if (!CanOpenViaFastPath(plugin_instance, gurl)) { | 432 const GURL gurl(candidates[i].second); |
| 434 resource_files_to_prefetch.clear(); | 433 // Important security check. Do not remove. |
| 435 break; | 434 if (!CanOpenViaFastPath(plugin_instance, gurl)) { |
| 435 resource_prefetch_info_list.clear(); | |
| 436 break; | |
| 437 } | |
| 438 resource_prefetch_info_list.push_back(NaClResourcePrefetchInfo( | |
| 439 candidates[i].first, candidates[i].second)); | |
| 436 } | 440 } |
| 437 } | 441 } |
| 438 } | 442 } |
| 439 | 443 |
| 440 #if defined(OS_POSIX) | 444 #if defined(OS_POSIX) |
| 441 if (nexe_file_info->handle != PP_kInvalidFileHandle) | 445 if (nexe_file_info->handle != PP_kInvalidFileHandle) |
| 442 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); | 446 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
| 443 #elif defined(OS_WIN) | 447 #elif defined(OS_WIN) |
| 444 // Duplicate the handle on the browser side instead of the renderer. | 448 // Duplicate the handle on the browser side instead of the renderer. |
| 445 // This is because BrokerGetFileForProcess isn't part of content/public, and | 449 // This is because BrokerGetFileForProcess isn't part of content/public, and |
| 446 // it's simpler to do the duplication in the browser anyway. | 450 // it's simpler to do the duplication in the browser anyway. |
| 447 nexe_for_transit = nexe_file_info->handle; | 451 nexe_for_transit = nexe_file_info->handle; |
| 448 #else | 452 #else |
| 449 #error Unsupported target platform. | 453 #error Unsupported target platform. |
| 450 #endif | 454 #endif |
| 451 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 455 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
| 452 NaClLaunchParams( | 456 NaClLaunchParams( |
| 453 instance_info.url.spec(), | 457 instance_info.url.spec(), |
| 454 nexe_for_transit, | 458 nexe_for_transit, |
| 455 nexe_file_info->token_lo, | 459 nexe_file_info->token_lo, |
| 456 nexe_file_info->token_hi, | 460 nexe_file_info->token_hi, |
| 457 resource_files_to_prefetch, | 461 resource_prefetch_info_list, |
| 458 routing_id, | 462 routing_id, |
| 459 perm_bits, | 463 perm_bits, |
| 460 PP_ToBool(uses_nonsfi_mode), | 464 PP_ToBool(uses_nonsfi_mode), |
| 461 process_type), | 465 process_type), |
| 462 &launch_result, | 466 &launch_result, |
| 463 &error_message_string))) { | 467 &error_message_string))) { |
| 464 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 468 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 465 FROM_HERE, | 469 FROM_HERE, |
| 466 base::Bind(callback.func, callback.user_data, | 470 base::Bind(callback.func, callback.user_data, |
| 467 static_cast<int32_t>(PP_ERROR_FAILED))); | 471 static_cast<int32_t>(PP_ERROR_FAILED))); |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1727 &StreamPexe | 1731 &StreamPexe |
| 1728 }; | 1732 }; |
| 1729 | 1733 |
| 1730 } // namespace | 1734 } // namespace |
| 1731 | 1735 |
| 1732 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1736 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1733 return &nacl_interface; | 1737 return &nacl_interface; |
| 1734 } | 1738 } |
| 1735 | 1739 |
| 1736 } // namespace nacl | 1740 } // namespace nacl |
| OLD | NEW |