Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 1085583005: Refactor params of NaClProcessMsg_Start. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (load_manager->DevInterfacesEnabled()) 413 if (load_manager->DevInterfacesEnabled())
414 perm_bits |= ppapi::PERMISSION_DEV; 414 perm_bits |= ppapi::PERMISSION_DEV;
415 instance_info.permissions = 415 instance_info.permissions =
416 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); 416 ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
417 std::string error_message_string; 417 std::string error_message_string;
418 NaClLaunchResult launch_result; 418 NaClLaunchResult launch_result;
419 419
420 IPC::PlatformFileForTransit nexe_for_transit = 420 IPC::PlatformFileForTransit nexe_for_transit =
421 IPC::InvalidPlatformFileForTransit(); 421 IPC::InvalidPlatformFileForTransit();
422 422
423 std::vector<std::pair< 423 std::vector<NaClResourcePrefetchRequest> resource_prefetch_request_list;
424 std::string /*key*/, std::string /*url*/> > resource_files_to_prefetch;
425 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) { 424 if (process_type == kNativeNaClProcessType && uses_nonsfi_mode) {
426 JsonManifest* manifest = GetJsonManifest(instance); 425 JsonManifest* manifest = GetJsonManifest(instance);
427 if (manifest) 426 if (manifest) {
428 manifest->GetPrefetchableFiles(&resource_files_to_prefetch); 427 manifest->GetPrefetchableFiles(&resource_prefetch_request_list);
429 for (size_t i = 0; i < resource_files_to_prefetch.size(); ++i) { 428
430 const GURL gurl(resource_files_to_prefetch[i].second); 429 for (size_t i = 0; i < resource_prefetch_request_list.size(); ++i) {
431 // Important security check. Do not remove. 430 const GURL gurl(resource_prefetch_request_list[i].resource_url);
432 if (!CanOpenViaFastPath(plugin_instance, gurl)) { 431 // Important security check. Do not remove.
433 resource_files_to_prefetch.clear(); 432 if (!CanOpenViaFastPath(plugin_instance, gurl)) {
434 break; 433 resource_prefetch_request_list.clear();
434 break;
435 }
435 } 436 }
436 } 437 }
437 } 438 }
438 439
439 #if defined(OS_POSIX) 440 #if defined(OS_POSIX)
440 if (nexe_file_info->handle != PP_kInvalidFileHandle) 441 if (nexe_file_info->handle != PP_kInvalidFileHandle)
441 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); 442 nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true);
442 #elif defined(OS_WIN) 443 #elif defined(OS_WIN)
443 // Duplicate the handle on the browser side instead of the renderer. 444 // Duplicate the handle on the browser side instead of the renderer.
444 // This is because BrokerGetFileForProcess isn't part of content/public, and 445 // This is because BrokerGetFileForProcess isn't part of content/public, and
445 // it's simpler to do the duplication in the browser anyway. 446 // it's simpler to do the duplication in the browser anyway.
446 nexe_for_transit = nexe_file_info->handle; 447 nexe_for_transit = nexe_file_info->handle;
447 #else 448 #else
448 #error Unsupported target platform. 449 #error Unsupported target platform.
449 #endif 450 #endif
450 if (!sender->Send(new NaClHostMsg_LaunchNaCl( 451 if (!sender->Send(new NaClHostMsg_LaunchNaCl(
451 NaClLaunchParams( 452 NaClLaunchParams(
452 instance_info.url.spec(), 453 instance_info.url.spec(),
453 nexe_for_transit, 454 nexe_for_transit,
454 nexe_file_info->token_lo, 455 nexe_file_info->token_lo,
455 nexe_file_info->token_hi, 456 nexe_file_info->token_hi,
456 resource_files_to_prefetch, 457 resource_prefetch_request_list,
457 routing_id, 458 routing_id,
458 perm_bits, 459 perm_bits,
459 PP_ToBool(uses_nonsfi_mode), 460 PP_ToBool(uses_nonsfi_mode),
460 process_type), 461 process_type),
461 &launch_result, 462 &launch_result,
462 &error_message_string))) { 463 &error_message_string))) {
463 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( 464 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
464 FROM_HERE, 465 FROM_HERE,
465 base::Bind(callback.func, callback.user_data, 466 base::Bind(callback.func, callback.user_data,
466 static_cast<int32_t>(PP_ERROR_FAILED))); 467 static_cast<int32_t>(PP_ERROR_FAILED)));
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 &StreamPexe 1708 &StreamPexe
1708 }; 1709 };
1709 1710
1710 } // namespace 1711 } // namespace
1711 1712
1712 const PPB_NaCl_Private* GetNaClPrivateInterface() { 1713 const PPB_NaCl_Private* GetNaClPrivateInterface() {
1713 return &nacl_interface; 1714 return &nacl_interface;
1714 } 1715 }
1715 1716
1716 } // namespace nacl 1717 } // namespace nacl
OLDNEW
« components/nacl/loader/nacl_listener.cc ('K') | « components/nacl/renderer/json_manifest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698