| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/containers/scoped_ptr_hash_map.h" | |
| 15 #include "base/cpu.h" | 14 #include "base/cpu.h" |
| 16 #include "base/files/file.h" | 15 #include "base/files/file.h" |
| 17 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| 19 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 20 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 21 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 22 #include "components/nacl/common/nacl_host_messages.h" | 21 #include "components/nacl/common/nacl_host_messages.h" |
| 23 #include "components/nacl/common/nacl_messages.h" | 22 #include "components/nacl/common/nacl_messages.h" |
| 24 #include "components/nacl/common/nacl_nonsfi_util.h" | 23 #include "components/nacl/common/nacl_nonsfi_util.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 base::ProcessId plugin_pid; | 95 base::ProcessId plugin_pid; |
| 97 int plugin_child_id; | 96 int plugin_child_id; |
| 98 IPC::ChannelHandle channel_handle; | 97 IPC::ChannelHandle channel_handle; |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 typedef std::map<PP_Instance, InstanceInfo> InstanceInfoMap; | 100 typedef std::map<PP_Instance, InstanceInfo> InstanceInfoMap; |
| 102 | 101 |
| 103 base::LazyInstance<InstanceInfoMap> g_instance_info = | 102 base::LazyInstance<InstanceInfoMap> g_instance_info = |
| 104 LAZY_INSTANCE_INITIALIZER; | 103 LAZY_INSTANCE_INITIALIZER; |
| 105 | 104 |
| 106 typedef base::ScopedPtrHashMap<PP_Instance, NexeLoadManager> | |
| 107 NexeLoadManagerMap; | |
| 108 | |
| 109 base::LazyInstance<NexeLoadManagerMap> g_load_manager_map = | |
| 110 LAZY_INSTANCE_INITIALIZER; | |
| 111 | |
| 112 nacl::NexeLoadManager* GetNexeLoadManager(PP_Instance instance) { | |
| 113 NexeLoadManagerMap& map = g_load_manager_map.Get(); | |
| 114 NexeLoadManagerMap::iterator iter = map.find(instance); | |
| 115 if (iter != map.end()) | |
| 116 return iter->second; | |
| 117 return NULL; | |
| 118 } | |
| 119 | |
| 120 static const PP_NaClFileInfo kInvalidNaClFileInfo = { | 105 static const PP_NaClFileInfo kInvalidNaClFileInfo = { |
| 121 PP_kInvalidFileHandle, | 106 PP_kInvalidFileHandle, |
| 122 0, // token_lo | 107 0, // token_lo |
| 123 0, // token_hi | 108 0, // token_hi |
| 124 }; | 109 }; |
| 125 | 110 |
| 126 int GetRoutingID(PP_Instance instance) { | 111 int GetRoutingID(PP_Instance instance) { |
| 127 // Check that we are on the main renderer thread. | 112 // Check that we are on the main renderer thread. |
| 128 DCHECK(content::RenderThread::Get()); | 113 DCHECK(content::RenderThread::Get()); |
| 129 content::RendererPpapiHost *host = | 114 content::RendererPpapiHost *host = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 public: | 163 public: |
| 179 ManifestServiceProxy(PP_Instance pp_instance) | 164 ManifestServiceProxy(PP_Instance pp_instance) |
| 180 : pp_instance_(pp_instance) { | 165 : pp_instance_(pp_instance) { |
| 181 } | 166 } |
| 182 | 167 |
| 183 virtual ~ManifestServiceProxy() { } | 168 virtual ~ManifestServiceProxy() { } |
| 184 | 169 |
| 185 virtual void StartupInitializationComplete() OVERRIDE { | 170 virtual void StartupInitializationComplete() OVERRIDE { |
| 186 if (StartPpapiProxy(pp_instance_) == PP_TRUE) { | 171 if (StartPpapiProxy(pp_instance_) == PP_TRUE) { |
| 187 JsonManifest* manifest = GetJsonManifest(pp_instance_); | 172 JsonManifest* manifest = GetJsonManifest(pp_instance_); |
| 188 NexeLoadManager* load_manager = GetNexeLoadManager(pp_instance_); | 173 NexeLoadManager* load_manager = NexeLoadManager::Get(pp_instance_); |
| 189 if (load_manager && manifest) { | 174 if (load_manager && manifest) { |
| 190 std::string full_url; | 175 std::string full_url; |
| 191 PP_PNaClOptions pnacl_options; | 176 PP_PNaClOptions pnacl_options; |
| 192 bool uses_nonsfi_mode; | 177 bool uses_nonsfi_mode; |
| 193 JsonManifest::ErrorInfo error_info; | 178 JsonManifest::ErrorInfo error_info; |
| 194 if (manifest->GetProgramURL(&full_url, | 179 if (manifest->GetProgramURL(&full_url, |
| 195 &pnacl_options, | 180 &pnacl_options, |
| 196 &uses_nonsfi_mode, | 181 &uses_nonsfi_mode, |
| 197 &error_info)) { | 182 &error_info)) { |
| 198 int64_t nexe_size = load_manager->nexe_size(); | 183 int64_t nexe_size = load_manager->nexe_size(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 &error_message_string))) { | 361 &error_message_string))) { |
| 377 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 362 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 378 FROM_HERE, | 363 FROM_HERE, |
| 379 base::Bind(callback.func, callback.user_data, | 364 base::Bind(callback.func, callback.user_data, |
| 380 static_cast<int32_t>(PP_ERROR_FAILED))); | 365 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 381 return; | 366 return; |
| 382 } | 367 } |
| 383 | 368 |
| 384 if (!error_message_string.empty()) { | 369 if (!error_message_string.empty()) { |
| 385 if (PP_ToBool(main_service_runtime)) { | 370 if (PP_ToBool(main_service_runtime)) { |
| 386 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 371 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 387 if (load_manager) { | 372 if (load_manager) { |
| 388 load_manager->ReportLoadError(PP_NACL_ERROR_SEL_LDR_LAUNCH, | 373 load_manager->ReportLoadError(PP_NACL_ERROR_SEL_LDR_LAUNCH, |
| 389 "ServiceRuntime: failed to start", | 374 "ServiceRuntime: failed to start", |
| 390 error_message_string); | 375 error_message_string); |
| 391 } | 376 } |
| 392 } | 377 } |
| 393 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 378 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 394 FROM_HERE, | 379 FROM_HERE, |
| 395 base::Bind(callback.func, callback.user_data, | 380 base::Bind(callback.func, callback.user_data, |
| 396 static_cast<int32_t>(PP_ERROR_FAILED))); | 381 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 397 return; | 382 return; |
| 398 } | 383 } |
| 399 result_socket = launch_result.imc_channel_handle; | 384 result_socket = launch_result.imc_channel_handle; |
| 400 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; | 385 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; |
| 401 instance_info.plugin_pid = launch_result.plugin_pid; | 386 instance_info.plugin_pid = launch_result.plugin_pid; |
| 402 instance_info.plugin_child_id = launch_result.plugin_child_id; | 387 instance_info.plugin_child_id = launch_result.plugin_child_id; |
| 403 | 388 |
| 404 // Don't save instance_info if channel handle is invalid. | 389 // Don't save instance_info if channel handle is invalid. |
| 405 if (IsValidChannelHandle(instance_info.channel_handle)) | 390 if (IsValidChannelHandle(instance_info.channel_handle)) |
| 406 g_instance_info.Get()[instance] = instance_info; | 391 g_instance_info.Get()[instance] = instance_info; |
| 407 | 392 |
| 408 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket); | 393 *(static_cast<NaClHandle*>(imc_handle)) = ToNativeHandle(result_socket); |
| 409 | 394 |
| 410 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 395 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 411 DCHECK(load_manager); | 396 DCHECK(load_manager); |
| 412 if (!load_manager) { | 397 if (!load_manager) { |
| 413 PostPPCompletionCallback(callback, PP_ERROR_FAILED); | 398 PostPPCompletionCallback(callback, PP_ERROR_FAILED); |
| 414 return; | 399 return; |
| 415 } | 400 } |
| 416 | 401 |
| 417 // Create the trusted plugin channel. | 402 // Create the trusted plugin channel. |
| 418 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) { | 403 if (IsValidChannelHandle(launch_result.trusted_ipc_channel_handle)) { |
| 419 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel( | 404 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel( |
| 420 new TrustedPluginChannel( | 405 new TrustedPluginChannel( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 446 manifest_service_channel.Pass()); | 431 manifest_service_channel.Pass()); |
| 447 } else { | 432 } else { |
| 448 // Currently, manifest service works only on linux/non-SFI mode. | 433 // Currently, manifest service works only on linux/non-SFI mode. |
| 449 // On other platforms, the socket will not be created, and thus this | 434 // On other platforms, the socket will not be created, and thus this |
| 450 // condition needs to be handled as success. | 435 // condition needs to be handled as success. |
| 451 PostPPCompletionCallback(callback, PP_OK); | 436 PostPPCompletionCallback(callback, PP_OK); |
| 452 } | 437 } |
| 453 } | 438 } |
| 454 | 439 |
| 455 PP_Bool StartPpapiProxy(PP_Instance instance) { | 440 PP_Bool StartPpapiProxy(PP_Instance instance) { |
| 456 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 441 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 457 DCHECK(load_manager); | 442 DCHECK(load_manager); |
| 458 if (!load_manager) | 443 if (!load_manager) |
| 459 return PP_FALSE; | 444 return PP_FALSE; |
| 460 | 445 |
| 461 content::PepperPluginInstance* plugin_instance = | 446 content::PepperPluginInstance* plugin_instance = |
| 462 content::PepperPluginInstance::Get(instance); | 447 content::PepperPluginInstance::Get(instance); |
| 463 if (!plugin_instance) { | 448 if (!plugin_instance) { |
| 464 DLOG(ERROR) << "GetInstance() failed"; | 449 DLOG(ERROR) << "GetInstance() failed"; |
| 465 return PP_FALSE; | 450 return PP_FALSE; |
| 466 } | 451 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 if (opt_level < 0 || opt_level > 3) | 632 if (opt_level < 0 || opt_level > 3) |
| 648 opt_level = kUnknownOptLevel; | 633 opt_level = kUnknownOptLevel; |
| 649 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel", | 634 HistogramEnumerate("NaCl.Options.PNaCl.OptLevel", |
| 650 opt_level, | 635 opt_level, |
| 651 kUnknownOptLevel + 1); | 636 kUnknownOptLevel + 1); |
| 652 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", | 637 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.CompileKBPerSec", |
| 653 pexe_size / 1024, | 638 pexe_size / 1024, |
| 654 compile_time_us); | 639 compile_time_us); |
| 655 HistogramSizeKB("NaCl.Perf.Size.Pexe", pexe_size / 1024); | 640 HistogramSizeKB("NaCl.Perf.Size.Pexe", pexe_size / 1024); |
| 656 | 641 |
| 657 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 642 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 658 if (load_manager) { | 643 if (load_manager) { |
| 659 base::TimeDelta total_time = base::Time::Now() - | 644 base::TimeDelta total_time = base::Time::Now() - |
| 660 load_manager->pnacl_start_time(); | 645 load_manager->pnacl_start_time(); |
| 661 HistogramTimeTranslation("NaCl.Perf.PNaClLoadTime.TotalUncachedTime", | 646 HistogramTimeTranslation("NaCl.Perf.PNaClLoadTime.TotalUncachedTime", |
| 662 total_time.InMilliseconds()); | 647 total_time.InMilliseconds()); |
| 663 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", | 648 HistogramKBPerSec("NaCl.Perf.PNaClLoadTime.TotalUncachedKBPerSec", |
| 664 pexe_size / 1024, | 649 pexe_size / 1024, |
| 665 total_time.InMicroseconds()); | 650 total_time.InMicroseconds()); |
| 666 } | 651 } |
| 667 } | 652 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 resource_url, | 711 resource_url, |
| 727 PP_ToBool(length_is_computable), | 712 PP_ToBool(length_is_computable), |
| 728 loaded_bytes, | 713 loaded_bytes, |
| 729 total_bytes); | 714 total_bytes); |
| 730 DispatchProgressEvent(instance, event); | 715 DispatchProgressEvent(instance, event); |
| 731 } | 716 } |
| 732 | 717 |
| 733 void ReportLoadSuccess(PP_Instance instance, | 718 void ReportLoadSuccess(PP_Instance instance, |
| 734 uint64_t loaded_bytes, | 719 uint64_t loaded_bytes, |
| 735 uint64_t total_bytes) { | 720 uint64_t total_bytes) { |
| 736 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 721 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 737 if (load_manager) { | 722 if (load_manager) { |
| 738 load_manager->ReportLoadSuccess(load_manager->program_url(), | 723 load_manager->ReportLoadSuccess(load_manager->program_url(), |
| 739 loaded_bytes, | 724 loaded_bytes, |
| 740 total_bytes); | 725 total_bytes); |
| 741 } | 726 } |
| 742 } | 727 } |
| 743 | 728 |
| 744 void ReportLoadError(PP_Instance instance, | 729 void ReportLoadError(PP_Instance instance, |
| 745 PP_NaClError error, | 730 PP_NaClError error, |
| 746 const char* error_message) { | 731 const char* error_message) { |
| 747 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 732 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 748 if (load_manager) | 733 if (load_manager) |
| 749 load_manager->ReportLoadError(error, error_message); | 734 load_manager->ReportLoadError(error, error_message); |
| 750 } | 735 } |
| 751 | 736 |
| 752 void ReportLoadAbort(PP_Instance instance) { | 737 void ReportLoadAbort(PP_Instance instance) { |
| 753 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 738 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 754 if (load_manager) | 739 if (load_manager) |
| 755 load_manager->ReportLoadAbort(); | 740 load_manager->ReportLoadAbort(); |
| 756 } | 741 } |
| 757 | 742 |
| 758 void NexeDidCrash(PP_Instance instance, const char* crash_log) { | 743 void NexeDidCrash(PP_Instance instance, const char* crash_log) { |
| 759 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 744 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 760 if (load_manager) | 745 if (load_manager) |
| 761 load_manager->NexeDidCrash(crash_log); | 746 load_manager->NexeDidCrash(crash_log); |
| 762 } | 747 } |
| 763 | 748 |
| 764 void InstanceCreated(PP_Instance instance) { | 749 void InstanceCreated(PP_Instance instance) { |
| 765 scoped_ptr<NexeLoadManager> new_load_manager(new NexeLoadManager(instance)); | 750 NexeLoadManager::Create(instance); |
| 766 NexeLoadManagerMap& map = g_load_manager_map.Get(); | |
| 767 DLOG_IF(ERROR, map.count(instance) != 0) << "Instance count should be 0"; | |
| 768 map.add(instance, new_load_manager.Pass()); | |
| 769 } | 751 } |
| 770 | 752 |
| 771 void InstanceDestroyed(PP_Instance instance) { | 753 void InstanceDestroyed(PP_Instance instance) { |
| 772 DeleteJsonManifest(instance); | 754 DeleteJsonManifest(instance); |
| 773 | 755 NexeLoadManager::Delete(instance); |
| 774 NexeLoadManagerMap& map = g_load_manager_map.Get(); | |
| 775 DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID"; | |
| 776 // The erase may call NexeLoadManager's destructor prior to removing it from | |
| 777 // the map. In that case, it is possible for the trusted Plugin to re-enter | |
| 778 // the NexeLoadManager (e.g., by calling ReportLoadError). Passing out the | |
| 779 // NexeLoadManager to a local scoped_ptr just ensures that its entry is gone | |
| 780 // from the map prior to the destructor being invoked. | |
| 781 scoped_ptr<NexeLoadManager> temp(map.take(instance)); | |
| 782 map.erase(instance); | |
| 783 } | 756 } |
| 784 | 757 |
| 785 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { | 758 PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) { |
| 786 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) | 759 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug)) |
| 787 return PP_FALSE; | 760 return PP_FALSE; |
| 788 IPC::Sender* sender = content::RenderThread::Get(); | 761 IPC::Sender* sender = content::RenderThread::Get(); |
| 789 DCHECK(sender); | 762 DCHECK(sender); |
| 790 bool should_debug = false; | 763 bool should_debug = false; |
| 791 return PP_FromBool( | 764 return PP_FromBool( |
| 792 sender->Send(new NaClHostMsg_NaClDebugEnabledForURL(GURL(alleged_nmf_url), | 765 sender->Send(new NaClHostMsg_NaClDebugEnabledForURL(GURL(alleged_nmf_url), |
| 793 &should_debug)) && | 766 &should_debug)) && |
| 794 should_debug); | 767 should_debug); |
| 795 } | 768 } |
| 796 | 769 |
| 797 void LogToConsole(PP_Instance instance, const char* message) { | 770 void LogToConsole(PP_Instance instance, const char* message) { |
| 798 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 771 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 799 DCHECK(load_manager); | 772 DCHECK(load_manager); |
| 800 if (load_manager) | 773 if (load_manager) |
| 801 load_manager->LogToConsole(std::string(message)); | 774 load_manager->LogToConsole(std::string(message)); |
| 802 } | 775 } |
| 803 | 776 |
| 804 PP_NaClReadyState GetNaClReadyState(PP_Instance instance) { | 777 PP_NaClReadyState GetNaClReadyState(PP_Instance instance) { |
| 805 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 778 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 806 DCHECK(load_manager); | 779 DCHECK(load_manager); |
| 807 if (load_manager) | 780 if (load_manager) |
| 808 return load_manager->nacl_ready_state(); | 781 return load_manager->nacl_ready_state(); |
| 809 return PP_NACL_READY_STATE_UNSENT; | 782 return PP_NACL_READY_STATE_UNSENT; |
| 810 } | 783 } |
| 811 | 784 |
| 812 int32_t GetExitStatus(PP_Instance instance) { | 785 int32_t GetExitStatus(PP_Instance instance) { |
| 813 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 786 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 814 DCHECK(load_manager); | 787 DCHECK(load_manager); |
| 815 if (load_manager) | 788 if (load_manager) |
| 816 return load_manager->exit_status(); | 789 return load_manager->exit_status(); |
| 817 return -1; | 790 return -1; |
| 818 } | 791 } |
| 819 | 792 |
| 820 void SetExitStatus(PP_Instance instance, int32_t exit_status) { | 793 void SetExitStatus(PP_Instance instance, int32_t exit_status) { |
| 821 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 794 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 822 DCHECK(load_manager); | 795 DCHECK(load_manager); |
| 823 if (load_manager) | 796 if (load_manager) |
| 824 return load_manager->set_exit_status(exit_status); | 797 return load_manager->set_exit_status(exit_status); |
| 825 } | 798 } |
| 826 | 799 |
| 827 void Vlog(const char* message) { | 800 void Vlog(const char* message) { |
| 828 VLOG(1) << message; | 801 VLOG(1) << message; |
| 829 } | 802 } |
| 830 | 803 |
| 831 void InitializePlugin(PP_Instance instance, | 804 void InitializePlugin(PP_Instance instance, |
| 832 uint32_t argc, | 805 uint32_t argc, |
| 833 const char* argn[], | 806 const char* argn[], |
| 834 const char* argv[]) { | 807 const char* argv[]) { |
| 835 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 808 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 836 DCHECK(load_manager); | 809 DCHECK(load_manager); |
| 837 if (load_manager) | 810 if (load_manager) |
| 838 load_manager->InitializePlugin(argc, argn, argv); | 811 load_manager->InitializePlugin(argc, argn, argv); |
| 839 } | 812 } |
| 840 | 813 |
| 841 int64_t GetNexeSize(PP_Instance instance) { | 814 int64_t GetNexeSize(PP_Instance instance) { |
| 842 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 815 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 843 DCHECK(load_manager); | 816 DCHECK(load_manager); |
| 844 if (load_manager) | 817 if (load_manager) |
| 845 return load_manager->nexe_size(); | 818 return load_manager->nexe_size(); |
| 846 return 0; | 819 return 0; |
| 847 } | 820 } |
| 848 | 821 |
| 849 void DownloadManifestToBuffer(PP_Instance instance, | 822 void DownloadManifestToBuffer(PP_Instance instance, |
| 850 struct PP_CompletionCallback callback); | 823 struct PP_CompletionCallback callback); |
| 851 | 824 |
| 852 bool CreateJsonManifest(PP_Instance instance, | 825 bool CreateJsonManifest(PP_Instance instance, |
| 853 const std::string& manifest_url, | 826 const std::string& manifest_url, |
| 854 const std::string& manifest_data); | 827 const std::string& manifest_data); |
| 855 | 828 |
| 856 void RequestNaClManifest(PP_Instance instance, | 829 void RequestNaClManifest(PP_Instance instance, |
| 857 PP_CompletionCallback callback) { | 830 PP_CompletionCallback callback) { |
| 858 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 831 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 859 DCHECK(load_manager); | 832 DCHECK(load_manager); |
| 860 if (!load_manager) { | 833 if (!load_manager) { |
| 861 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 834 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 862 FROM_HERE, | 835 FROM_HERE, |
| 863 base::Bind(callback.func, callback.user_data, | 836 base::Bind(callback.func, callback.user_data, |
| 864 static_cast<int32_t>(PP_ERROR_FAILED))); | 837 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 865 return; | 838 return; |
| 866 } | 839 } |
| 867 | 840 |
| 868 std::string url = load_manager->GetManifestURLArgument(); | 841 std::string url = load_manager->GetManifestURLArgument(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 895 } | 868 } |
| 896 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 869 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 897 FROM_HERE, | 870 FROM_HERE, |
| 898 base::Bind(callback.func, callback.user_data, error)); | 871 base::Bind(callback.func, callback.user_data, error)); |
| 899 } else { | 872 } else { |
| 900 DownloadManifestToBuffer(instance, callback); | 873 DownloadManifestToBuffer(instance, callback); |
| 901 } | 874 } |
| 902 } | 875 } |
| 903 | 876 |
| 904 PP_Var GetManifestBaseURL(PP_Instance instance) { | 877 PP_Var GetManifestBaseURL(PP_Instance instance) { |
| 905 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 878 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 906 DCHECK(load_manager); | 879 DCHECK(load_manager); |
| 907 if (!load_manager) | 880 if (!load_manager) |
| 908 return PP_MakeUndefined(); | 881 return PP_MakeUndefined(); |
| 909 const GURL& gurl = load_manager->manifest_base_url(); | 882 const GURL& gurl = load_manager->manifest_base_url(); |
| 910 if (!gurl.is_valid()) | 883 if (!gurl.is_valid()) |
| 911 return PP_MakeUndefined(); | 884 return PP_MakeUndefined(); |
| 912 return ppapi::StringVar::StringToPPVar(gurl.spec()); | 885 return ppapi::StringVar::StringToPPVar(gurl.spec()); |
| 913 } | 886 } |
| 914 | 887 |
| 915 void ProcessNaClManifest(PP_Instance instance, const char* program_url) { | 888 void ProcessNaClManifest(PP_Instance instance, const char* program_url) { |
| 916 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 889 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 917 if (load_manager) | 890 if (load_manager) |
| 918 load_manager->ProcessNaClManifest(program_url); | 891 load_manager->ProcessNaClManifest(program_url); |
| 919 } | 892 } |
| 920 | 893 |
| 921 PP_Bool DevInterfacesEnabled(PP_Instance instance) { | 894 PP_Bool DevInterfacesEnabled(PP_Instance instance) { |
| 922 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 895 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 923 if (load_manager) | 896 if (load_manager) |
| 924 return PP_FromBool(load_manager->DevInterfacesEnabled()); | 897 return PP_FromBool(load_manager->DevInterfacesEnabled()); |
| 925 return PP_FALSE; | 898 return PP_FALSE; |
| 926 } | 899 } |
| 927 | 900 |
| 928 void DownloadManifestToBufferCompletion(PP_Instance instance, | 901 void DownloadManifestToBufferCompletion(PP_Instance instance, |
| 929 struct PP_CompletionCallback callback, | 902 struct PP_CompletionCallback callback, |
| 930 base::Time start_time, | 903 base::Time start_time, |
| 931 PP_NaClError pp_nacl_error, | 904 PP_NaClError pp_nacl_error, |
| 932 const std::string& data); | 905 const std::string& data); |
| 933 | 906 |
| 934 void DownloadManifestToBuffer(PP_Instance instance, | 907 void DownloadManifestToBuffer(PP_Instance instance, |
| 935 struct PP_CompletionCallback callback) { | 908 struct PP_CompletionCallback callback) { |
| 936 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 909 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 937 DCHECK(load_manager); | 910 DCHECK(load_manager); |
| 938 content::PepperPluginInstance* plugin_instance = | 911 content::PepperPluginInstance* plugin_instance = |
| 939 content::PepperPluginInstance::Get(instance); | 912 content::PepperPluginInstance::Get(instance); |
| 940 if (!load_manager || !plugin_instance) { | 913 if (!load_manager || !plugin_instance) { |
| 941 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 914 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 942 FROM_HERE, | 915 FROM_HERE, |
| 943 base::Bind(callback.func, callback.user_data, | 916 base::Bind(callback.func, callback.user_data, |
| 944 static_cast<int32_t>(PP_ERROR_FAILED))); | 917 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 945 } | 918 } |
| 946 const blink::WebDocument& document = | 919 const blink::WebDocument& document = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 962 | 935 |
| 963 void DownloadManifestToBufferCompletion(PP_Instance instance, | 936 void DownloadManifestToBufferCompletion(PP_Instance instance, |
| 964 struct PP_CompletionCallback callback, | 937 struct PP_CompletionCallback callback, |
| 965 base::Time start_time, | 938 base::Time start_time, |
| 966 PP_NaClError pp_nacl_error, | 939 PP_NaClError pp_nacl_error, |
| 967 const std::string& data) { | 940 const std::string& data) { |
| 968 base::TimeDelta download_time = base::Time::Now() - start_time; | 941 base::TimeDelta download_time = base::Time::Now() - start_time; |
| 969 HistogramTimeSmall("NaCl.Perf.StartupTime.ManifestDownload", | 942 HistogramTimeSmall("NaCl.Perf.StartupTime.ManifestDownload", |
| 970 download_time.InMilliseconds()); | 943 download_time.InMilliseconds()); |
| 971 | 944 |
| 972 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 945 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 973 if (!load_manager) { | 946 if (!load_manager) { |
| 974 callback.func(callback.user_data, PP_ERROR_ABORTED); | 947 callback.func(callback.user_data, PP_ERROR_ABORTED); |
| 975 return; | 948 return; |
| 976 } | 949 } |
| 977 | 950 |
| 978 int32_t pp_error; | 951 int32_t pp_error; |
| 979 switch (pp_nacl_error) { | 952 switch (pp_nacl_error) { |
| 980 case PP_NACL_ERROR_LOAD_SUCCESS: | 953 case PP_NACL_ERROR_LOAD_SUCCESS: |
| 981 pp_error = PP_OK; | 954 pp_error = PP_OK; |
| 982 break; | 955 break; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1009 } | 982 } |
| 1010 callback.func(callback.user_data, pp_error); | 983 callback.func(callback.user_data, pp_error); |
| 1011 } | 984 } |
| 1012 | 985 |
| 1013 bool CreateJsonManifest(PP_Instance instance, | 986 bool CreateJsonManifest(PP_Instance instance, |
| 1014 const std::string& manifest_url, | 987 const std::string& manifest_url, |
| 1015 const std::string& manifest_data) { | 988 const std::string& manifest_data) { |
| 1016 HistogramSizeKB("NaCl.Perf.Size.Manifest", | 989 HistogramSizeKB("NaCl.Perf.Size.Manifest", |
| 1017 static_cast<int32_t>(manifest_data.length() / 1024)); | 990 static_cast<int32_t>(manifest_data.length() / 1024)); |
| 1018 | 991 |
| 1019 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 992 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1020 if (!load_manager) | 993 if (!load_manager) |
| 1021 return false; | 994 return false; |
| 1022 | 995 |
| 1023 const char* isa_type; | 996 const char* isa_type; |
| 1024 if (load_manager->IsPNaCl()) | 997 if (load_manager->IsPNaCl()) |
| 1025 isa_type = kPortableArch; | 998 isa_type = kPortableArch; |
| 1026 else | 999 else |
| 1027 isa_type = GetSandboxArch(); | 1000 isa_type = GetSandboxArch(); |
| 1028 | 1001 |
| 1029 scoped_ptr<nacl::JsonManifest> j( | 1002 scoped_ptr<nacl::JsonManifest> j( |
| 1030 new nacl::JsonManifest( | 1003 new nacl::JsonManifest( |
| 1031 manifest_url.c_str(), | 1004 manifest_url.c_str(), |
| 1032 isa_type, | 1005 isa_type, |
| 1033 IsNonSFIModeEnabled(), | 1006 IsNonSFIModeEnabled(), |
| 1034 PP_ToBool(NaClDebugEnabledForURL(manifest_url.c_str())))); | 1007 PP_ToBool(NaClDebugEnabledForURL(manifest_url.c_str())))); |
| 1035 JsonManifest::ErrorInfo error_info; | 1008 JsonManifest::ErrorInfo error_info; |
| 1036 if (j->Init(manifest_data.c_str(), &error_info)) { | 1009 if (j->Init(manifest_data.c_str(), &error_info)) { |
| 1037 AddJsonManifest(instance, j.Pass()); | 1010 AddJsonManifest(instance, j.Pass()); |
| 1038 return true; | 1011 return true; |
| 1039 } | 1012 } |
| 1040 load_manager->ReportLoadError(error_info.error, error_info.string); | 1013 load_manager->ReportLoadError(error_info.error, error_info.string); |
| 1041 return false; | 1014 return false; |
| 1042 } | 1015 } |
| 1043 | 1016 |
| 1044 PP_Bool ManifestGetProgramURL(PP_Instance instance, | 1017 PP_Bool ManifestGetProgramURL(PP_Instance instance, |
| 1045 PP_Var* pp_full_url, | 1018 PP_Var* pp_full_url, |
| 1046 PP_PNaClOptions* pnacl_options, | 1019 PP_PNaClOptions* pnacl_options, |
| 1047 PP_Bool* pp_uses_nonsfi_mode) { | 1020 PP_Bool* pp_uses_nonsfi_mode) { |
| 1048 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1021 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1049 | 1022 |
| 1050 JsonManifest* manifest = GetJsonManifest(instance); | 1023 JsonManifest* manifest = GetJsonManifest(instance); |
| 1051 if (manifest == NULL) | 1024 if (manifest == NULL) |
| 1052 return PP_FALSE; | 1025 return PP_FALSE; |
| 1053 | 1026 |
| 1054 bool uses_nonsfi_mode; | 1027 bool uses_nonsfi_mode; |
| 1055 std::string full_url; | 1028 std::string full_url; |
| 1056 JsonManifest::ErrorInfo error_info; | 1029 JsonManifest::ErrorInfo error_info; |
| 1057 if (manifest->GetProgramURL(&full_url, pnacl_options, &uses_nonsfi_mode, | 1030 if (manifest->GetProgramURL(&full_url, pnacl_options, &uses_nonsfi_mode, |
| 1058 &error_info)) { | 1031 &error_info)) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1071 const std::string& key, | 1044 const std::string& key, |
| 1072 std::string* full_url, | 1045 std::string* full_url, |
| 1073 PP_PNaClOptions* pnacl_options) { | 1046 PP_PNaClOptions* pnacl_options) { |
| 1074 // For "helper" processes (llc and ld, for PNaCl translation), we resolve | 1047 // For "helper" processes (llc and ld, for PNaCl translation), we resolve |
| 1075 // keys manually as there is no existing .nmf file to parse. | 1048 // keys manually as there is no existing .nmf file to parse. |
| 1076 if (is_helper_process) { | 1049 if (is_helper_process) { |
| 1077 pnacl_options->translate = PP_FALSE; | 1050 pnacl_options->translate = PP_FALSE; |
| 1078 // We can only resolve keys in the files/ namespace. | 1051 // We can only resolve keys in the files/ namespace. |
| 1079 const std::string kFilesPrefix = "files/"; | 1052 const std::string kFilesPrefix = "files/"; |
| 1080 if (key.find(kFilesPrefix) == std::string::npos) { | 1053 if (key.find(kFilesPrefix) == std::string::npos) { |
| 1081 nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1054 nacl::NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1082 if (load_manager) | 1055 if (load_manager) |
| 1083 load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, | 1056 load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, |
| 1084 "key did not start with files/"); | 1057 "key did not start with files/"); |
| 1085 return false; | 1058 return false; |
| 1086 } | 1059 } |
| 1087 std::string key_basename = key.substr(kFilesPrefix.length()); | 1060 std::string key_basename = key.substr(kFilesPrefix.length()); |
| 1088 *full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" + | 1061 *full_url = std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" + |
| 1089 key_basename; | 1062 key_basename; |
| 1090 return true; | 1063 return true; |
| 1091 } | 1064 } |
| 1092 | 1065 |
| 1093 JsonManifest* manifest = GetJsonManifest(instance); | 1066 JsonManifest* manifest = GetJsonManifest(instance); |
| 1094 if (manifest == NULL) | 1067 if (manifest == NULL) |
| 1095 return false; | 1068 return false; |
| 1096 | 1069 |
| 1097 return manifest->ResolveKey(key, full_url, pnacl_options); | 1070 return manifest->ResolveKey(key, full_url, pnacl_options); |
| 1098 } | 1071 } |
| 1099 | 1072 |
| 1100 PP_Bool GetPNaClResourceInfo(PP_Instance instance, | 1073 PP_Bool GetPNaClResourceInfo(PP_Instance instance, |
| 1101 PP_Var* llc_tool_name, | 1074 PP_Var* llc_tool_name, |
| 1102 PP_Var* ld_tool_name) { | 1075 PP_Var* ld_tool_name) { |
| 1103 static const char kFilename[] = "chrome://pnacl-translator/pnacl.json"; | 1076 static const char kFilename[] = "chrome://pnacl-translator/pnacl.json"; |
| 1104 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1077 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1105 DCHECK(load_manager); | 1078 DCHECK(load_manager); |
| 1106 if (!load_manager) | 1079 if (!load_manager) |
| 1107 return PP_FALSE; | 1080 return PP_FALSE; |
| 1108 | 1081 |
| 1109 uint64_t nonce_lo = 0; | 1082 uint64_t nonce_lo = 0; |
| 1110 uint64_t nonce_hi = 0; | 1083 uint64_t nonce_hi = 0; |
| 1111 base::File file(GetReadonlyPnaclFd(kFilename, false /* is_executable */, | 1084 base::File file(GetReadonlyPnaclFd(kFilename, false /* is_executable */, |
| 1112 &nonce_lo, &nonce_hi)); | 1085 &nonce_lo, &nonce_hi)); |
| 1113 if (!file.IsValid()) { | 1086 if (!file.IsValid()) { |
| 1114 load_manager->ReportLoadError( | 1087 load_manager->ReportLoadError( |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 bytes_read = info.size; | 1299 bytes_read = info.size; |
| 1327 } | 1300 } |
| 1328 | 1301 |
| 1329 if (bytes_read == -1) { | 1302 if (bytes_read == -1) { |
| 1330 target_file.Close(); | 1303 target_file.Close(); |
| 1331 pp_error = PP_ERROR_FAILED; | 1304 pp_error = PP_ERROR_FAILED; |
| 1332 } | 1305 } |
| 1333 | 1306 |
| 1334 base::TimeDelta download_time = base::Time::Now() - request.start_time; | 1307 base::TimeDelta download_time = base::Time::Now() - request.start_time; |
| 1335 | 1308 |
| 1336 NexeLoadManager* load_manager = GetNexeLoadManager(request.instance); | 1309 NexeLoadManager* load_manager = NexeLoadManager::Get(request.instance); |
| 1337 if (load_manager) { | 1310 if (load_manager) { |
| 1338 load_manager->NexeFileDidOpen(pp_error, | 1311 load_manager->NexeFileDidOpen(pp_error, |
| 1339 target_file, | 1312 target_file, |
| 1340 http_status, | 1313 http_status, |
| 1341 bytes_read, | 1314 bytes_read, |
| 1342 request.url, | 1315 request.url, |
| 1343 download_time); | 1316 download_time); |
| 1344 } | 1317 } |
| 1345 | 1318 |
| 1346 if (pp_error == PP_OK && target_file.IsValid()) | 1319 if (pp_error == PP_OK && target_file.IsValid()) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1368 | 1341 |
| 1369 callback.Run(pp_error, file_info); | 1342 callback.Run(pp_error, file_info); |
| 1370 } | 1343 } |
| 1371 | 1344 |
| 1372 void DownloadFile(PP_Instance instance, | 1345 void DownloadFile(PP_Instance instance, |
| 1373 const std::string& url, | 1346 const std::string& url, |
| 1374 const DownloadFileCallback& callback) { | 1347 const DownloadFileCallback& callback) { |
| 1375 DCHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> | 1348 DCHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> |
| 1376 BelongsToCurrentThread()); | 1349 BelongsToCurrentThread()); |
| 1377 | 1350 |
| 1378 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1351 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1379 DCHECK(load_manager); | 1352 DCHECK(load_manager); |
| 1380 if (!load_manager) { | 1353 if (!load_manager) { |
| 1381 base::MessageLoop::current()->PostTask( | 1354 base::MessageLoop::current()->PostTask( |
| 1382 FROM_HERE, | 1355 FROM_HERE, |
| 1383 base::Bind(callback, | 1356 base::Bind(callback, |
| 1384 static_cast<int32_t>(PP_ERROR_FAILED), | 1357 static_cast<int32_t>(PP_ERROR_FAILED), |
| 1385 kInvalidNaClFileInfo)); | 1358 kInvalidNaClFileInfo)); |
| 1386 return; | 1359 return; |
| 1387 } | 1360 } |
| 1388 | 1361 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 base::Bind(&DownloadFileCompletion, callback), | 1441 base::Bind(&DownloadFileCompletion, callback), |
| 1469 base::Bind(&ProgressEventRateLimiter::ReportProgress, | 1442 base::Bind(&ProgressEventRateLimiter::ReportProgress, |
| 1470 base::Owned(tracker), std::string(url))); | 1443 base::Owned(tracker), std::string(url))); |
| 1471 file_downloader->Load(url_request); | 1444 file_downloader->Load(url_request); |
| 1472 } | 1445 } |
| 1473 | 1446 |
| 1474 void ReportSelLdrStatus(PP_Instance instance, | 1447 void ReportSelLdrStatus(PP_Instance instance, |
| 1475 int32_t load_status, | 1448 int32_t load_status, |
| 1476 int32_t max_status) { | 1449 int32_t max_status) { |
| 1477 HistogramEnumerate("NaCl.LoadStatus.SelLdr", load_status, max_status); | 1450 HistogramEnumerate("NaCl.LoadStatus.SelLdr", load_status, max_status); |
| 1478 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1451 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1479 DCHECK(load_manager); | 1452 DCHECK(load_manager); |
| 1480 if (!load_manager) | 1453 if (!load_manager) |
| 1481 return; | 1454 return; |
| 1482 | 1455 |
| 1483 // Gather data to see if being installed changes load outcomes. | 1456 // Gather data to see if being installed changes load outcomes. |
| 1484 const char* name = load_manager->is_installed() ? | 1457 const char* name = load_manager->is_installed() ? |
| 1485 "NaCl.LoadStatus.SelLdr.InstalledApp" : | 1458 "NaCl.LoadStatus.SelLdr.InstalledApp" : |
| 1486 "NaCl.LoadStatus.SelLdr.NotInstalledApp"; | 1459 "NaCl.LoadStatus.SelLdr.NotInstalledApp"; |
| 1487 HistogramEnumerate(name, load_status, max_status); | 1460 HistogramEnumerate(name, load_status, max_status); |
| 1488 } | 1461 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 PostPPCompletionCallback(callback, PP_ERROR_FAILED); | 1496 PostPPCompletionCallback(callback, PP_ERROR_FAILED); |
| 1524 } | 1497 } |
| 1525 | 1498 |
| 1526 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile | 1499 // TODO(teravest): Make a type like PP_NaClFileInfo to use for DownloadFile |
| 1527 // that would close the file handle on destruction. | 1500 // that would close the file handle on destruction. |
| 1528 DownloadFile(instance, url, | 1501 DownloadFile(instance, url, |
| 1529 base::Bind(&DidOpenManifestEntry, out_file_info, callback)); | 1502 base::Bind(&DidOpenManifestEntry, out_file_info, callback)); |
| 1530 } | 1503 } |
| 1531 | 1504 |
| 1532 void SetPNaClStartTime(PP_Instance instance) { | 1505 void SetPNaClStartTime(PP_Instance instance) { |
| 1533 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | 1506 NexeLoadManager* load_manager = NexeLoadManager::Get(instance); |
| 1534 if (load_manager) | 1507 if (load_manager) |
| 1535 load_manager->set_pnacl_start_time(base::Time::Now()); | 1508 load_manager->set_pnacl_start_time(base::Time::Now()); |
| 1536 } | 1509 } |
| 1537 | 1510 |
| 1538 // PexeDownloader is responsible for deleting itself when the download | 1511 // PexeDownloader is responsible for deleting itself when the download |
| 1539 // finishes. | 1512 // finishes. |
| 1540 class PexeDownloader : public blink::WebURLLoaderClient { | 1513 class PexeDownloader : public blink::WebURLLoaderClient { |
| 1541 public: | 1514 public: |
| 1542 PexeDownloader(PP_Instance instance, | 1515 PexeDownloader(PP_Instance instance, |
| 1543 scoped_ptr<blink::WebURLLoader> url_loader, | 1516 scoped_ptr<blink::WebURLLoader> url_loader, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 &StreamPexe | 1718 &StreamPexe |
| 1746 }; | 1719 }; |
| 1747 | 1720 |
| 1748 } // namespace | 1721 } // namespace |
| 1749 | 1722 |
| 1750 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1723 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1751 return &nacl_interface; | 1724 return &nacl_interface; |
| 1752 } | 1725 } |
| 1753 | 1726 |
| 1754 } // namespace nacl | 1727 } // namespace nacl |
| OLD | NEW |