Index: ppapi/native_client/src/trusted/plugin/plugin.cc |
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc |
index 518751c6981966f9e5a2c6a4c32077fd73c22b62..7f7e310502961f4b2f6c0453111f83bf73a8eb84 100644 |
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc |
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc |
@@ -117,6 +117,8 @@ void Plugin::SignalStartSelLdrDone(int32_t pp_error, |
} |
void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, |
+ PP_NaClResourceFileHandle* resource_file_handles, |
+ uint32_t resource_file_handles_len, |
bool uses_nonsfi_mode, |
PP_NaClAppProcessType process_type, |
const pp::CompletionCallback& init_done_cb) { |
@@ -132,6 +134,8 @@ void Plugin::LoadNaClModule(PP_NaClFileInfo file_info, |
SelLdrStartParams params(manifest_base_url_str, |
file_info, |
+ resource_file_handles, |
+ resource_file_handles_len, |
process_type); |
ErrorInfo error_info; |
ServiceRuntime* service_runtime = new ServiceRuntime( |
@@ -197,6 +201,8 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const std::string& helper_url, |
// done to save on address space and swap space. |
SelLdrStartParams params(helper_url, |
file_info, |
+ NULL, |
+ 0, |
PP_PNACL_TRANSLATOR_PROCESS_TYPE); |
// Helper NaCl modules always use the PNaCl manifest, as there is no |
@@ -248,6 +254,8 @@ Plugin::Plugin(PP_Instance pp_instance) |
main_subprocess_("main subprocess", NULL, NULL), |
uses_nonsfi_mode_(false), |
wrapper_factory_(NULL), |
+ resource_file_handles_(NULL), |
+ resource_file_handles_len_(0), |
nacl_interface_(NULL), |
uma_interface_(this) { |
callback_factory_.Initialize(this); |
@@ -296,6 +304,11 @@ Plugin::~Plugin() { |
delete wrapper_factory_; |
+ for (uint32_t i = 0; i < resource_file_handles_len_; ++i) { |
+ free(resource_file_handles_[i].key); |
+ } |
+ delete[] resource_file_handles_; |
+ |
HistogramTimeSmall( |
"NaCl.Perf.ShutdownTime.Total", |
(NaClGetTimeOfDayMicroseconds() - shutdown_start) |
@@ -313,6 +326,8 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { |
return; |
LoadNaClModule( |
nexe_file_info_, |
+ resource_file_handles_, |
+ resource_file_handles_len_, |
uses_nonsfi_mode_, |
PP_NATIVE_NACL_PROCESS_TYPE, |
callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation)); |
@@ -350,6 +365,8 @@ void Plugin::BitcodeDidTranslate(int32_t pp_error) { |
info.token_hi = 0; |
LoadNaClModule( |
info, |
+ NULL, |
+ 0, |
false, /* uses_nonsfi_mode */ |
PP_PNACL_PROCESS_TYPE, |
callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation)); |
@@ -399,7 +416,13 @@ void Plugin::NaClManifestFileDidOpen(int32_t pp_error) { |
// Will always call the callback on success or failure. |
nacl_interface_->DownloadNexe(pp_instance(), |
program_url.c_str(), |
+ // pre-open resource files on nonsfi mode |
+ // TODO(yusukes): Enable the feature for |
+ // SFI-NaCl too. |
+ uses_nonsfi_mode, |
&nexe_file_info_, |
+ &resource_file_handles_, |
+ &resource_file_handles_len_, |
open_callback.pp_completion_callback()); |
return; |
} |