Chromium Code Reviews| Index: components/nacl/browser/nacl_host_message_filter.cc |
| diff --git a/components/nacl/browser/nacl_host_message_filter.cc b/components/nacl/browser/nacl_host_message_filter.cc |
| index 60093eff3ffdfb2009e767c2c44a82063ca081cf..60376814698253d172412592502dcbbe6b099c59 100644 |
| --- a/components/nacl/browser/nacl_host_message_filter.cc |
| +++ b/components/nacl/browser/nacl_host_message_filter.cc |
| @@ -98,8 +98,8 @@ bool NaClHostMessageFilter::OnMessageReceived(const IPC::Message& message) { |
| OnTranslationFinished) |
| IPC_MESSAGE_HANDLER(NaClHostMsg_MissingArchError, |
| OnMissingArchError) |
| - IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_OpenNaClExecutable, |
| - OnOpenNaClExecutable) |
| + IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_OpenNaClResources, |
| + OnOpenNaClResources) |
| IPC_MESSAGE_HANDLER(NaClHostMsg_NaClGetNumProcessors, |
| OnNaClGetNumProcessors) |
| IPC_MESSAGE_HANDLER(NaClHostMsg_NaClDebugEnabledForURL, |
| @@ -152,6 +152,7 @@ void NaClHostMessageFilter::LaunchNaClContinuation( |
| }; |
| base::PlatformFile nexe_file; |
| + scoped_ptr<nacl::ResourceFileInfo[]> resource_files_info; |
| #if defined(OS_WIN) |
| // Duplicate the nexe file handle from the renderer process into the browser |
| // process. |
| @@ -169,9 +170,22 @@ void NaClHostMessageFilter::LaunchNaClContinuation( |
| Send(reply_msg); |
| return; |
| } |
| + // TODO(yusukes): Support pre-opening resource files. |
|
Mark Seaborn
2015/02/09 04:48:34
Nit: Add "on Windows"?
Yusuke Sato
2015/02/11 05:54:20
Done.
|
| #elif defined(OS_POSIX) |
| nexe_file = |
| IPC::PlatformFileForTransitToPlatformFile(launch_params.nexe_file); |
| + resource_files_info.reset(new nacl::ResourceFileInfo[ |
| + launch_params.resource_files_info.size()]); |
| + for (size_t i = 0; i < launch_params.resource_files_info.size(); ++i) { |
| + base::File file(IPC::PlatformFileForTransitToPlatformFile( |
| + launch_params.resource_files_info[i].file_info.file)); |
| + NaClFileToken token = { |
| + launch_params.resource_files_info[i].file_info.file_token_lo, |
| + launch_params.resource_files_info[i].file_info.file_token_hi |
| + }; |
| + resource_files_info[i] = nacl::ResourceFileInfo( |
| + file.Pass(), token, launch_params.resource_files_info[i].file_key); |
| + } |
| #else |
| #error Unsupported platform. |
| #endif |
| @@ -180,6 +194,8 @@ void NaClHostMessageFilter::LaunchNaClContinuation( |
| GURL(launch_params.manifest_url), |
| base::File(nexe_file), |
| nexe_token, |
| + resource_files_info.Pass(), |
| + launch_params.resource_files_info.size(), |
| permissions, |
| launch_params.render_view_id, |
| launch_params.permission_bits, |
| @@ -284,16 +300,16 @@ void NaClHostMessageFilter::OnMissingArchError(int render_view_id) { |
| ShowMissingArchInfobar(render_process_id_, render_view_id); |
| } |
| -void NaClHostMessageFilter::OnOpenNaClExecutable( |
| +void NaClHostMessageFilter::OnOpenNaClResources( |
| int render_view_id, |
| - const GURL& file_url, |
| + const std::vector<GURL>& resource_urls, |
| bool enable_validation_caching, |
| IPC::Message* reply_msg) { |
| - nacl_file_host::OpenNaClExecutable(this, |
| - render_view_id, |
| - file_url, |
| - enable_validation_caching, |
| - reply_msg); |
| + nacl_file_host::OpenNaClResources(this, |
| + render_view_id, |
| + resource_urls, |
| + enable_validation_caching, |
| + reply_msg); |
| } |
| void NaClHostMessageFilter::OnNaClDebugEnabledForURL(const GURL& nmf_url, |