Chromium Code Reviews| Index: components/nacl/renderer/ppb_nacl_private_impl.cc |
| diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc |
| index 9d7ebbcf8c2631bfecd749dbcac720598c633db0..25433ce00ea5335d88d750a8f9206b8d57d31f01 100644 |
| --- a/components/nacl/renderer/ppb_nacl_private_impl.cc |
| +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc |
| @@ -544,14 +544,15 @@ std::string PnaclComponentURLToFilename(const std::string& url) { |
| return r; |
| } |
| -PP_FileHandle GetReadonlyPnaclFd(const char* url) { |
| +PP_FileHandle GetReadonlyPnaclFd(const char* url, bool is_executable, |
| + uint64_t *nonce_lo, uint64_t *nonce_hi) { |
|
teravest
2014/06/26 21:19:24
Chromium style is "uint64_t* nonce_lo".
It trips m
jvoung (off chromium)
2014/06/26 22:48:39
oops -- done.
|
| std::string filename = PnaclComponentURLToFilename(url); |
| IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); |
| IPC::Sender* sender = content::RenderThread::Get(); |
| DCHECK(sender); |
| if (!sender->Send(new NaClHostMsg_GetReadonlyPnaclFD( |
| - std::string(filename), |
| - &out_fd))) { |
| + std::string(filename), is_executable, |
| + &out_fd, nonce_lo, nonce_hi))) { |
| return PP_kInvalidFileHandle; |
| } |
| if (out_fd == IPC::InvalidPlatformFileForTransit()) { |
| @@ -560,6 +561,14 @@ PP_FileHandle GetReadonlyPnaclFd(const char* url) { |
| return IPC::PlatformFileForTransitToPlatformFile(out_fd); |
| } |
| +void GetReadExecPnaclFd(const char* url, |
| + PP_NaClFileInfo* out_file_info) { |
| + *out_file_info = kInvalidNaClFileInfo; |
| + out_file_info->handle = GetReadonlyPnaclFd(url, true /* is_executable */, |
| + &out_file_info->token_lo, |
| + &out_file_info->token_hi); |
| +} |
| + |
| PP_FileHandle CreateTemporaryFile(PP_Instance instance) { |
| IPC::PlatformFileForTransit transit_fd = IPC::InvalidPlatformFileForTransit(); |
| IPC::Sender* sender = content::RenderThread::Get(); |
| @@ -1118,7 +1127,10 @@ PP_Bool GetPNaClResourceInfo(PP_Instance instance, |
| if (!load_manager) |
| return PP_FALSE; |
| - base::File file(GetReadonlyPnaclFd(filename)); |
| + uint64_t nonce_lo = 0; |
| + uint64_t nonce_hi = 0; |
| + base::File file(GetReadonlyPnaclFd(filename, false /* is_executable */, |
| + &nonce_lo, &nonce_hi)); |
| if (!file.IsValid()) { |
| load_manager->ReportLoadError( |
| PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
| @@ -1444,7 +1456,11 @@ void DownloadFile(PP_Instance instance, |
| // Handle special PNaCl support files which are installed on the user's |
| // machine. |
| if (url.find(kPNaClTranslatorBaseUrl, 0) == 0) { |
| - PP_FileHandle handle = GetReadonlyPnaclFd(url.c_str()); |
| + PP_NaClFileInfo file_info = kInvalidNaClFileInfo; |
| + PP_FileHandle handle = GetReadonlyPnaclFd(url.c_str(), |
| + false /* executable*/, |
| + &file_info.token_lo, |
| + &file_info.token_hi); |
| if (handle == PP_kInvalidFileHandle) { |
| base::MessageLoop::current()->PostTask( |
| FROM_HERE, |
| @@ -1453,12 +1469,7 @@ void DownloadFile(PP_Instance instance, |
| kInvalidNaClFileInfo)); |
| return; |
| } |
| - // TODO(ncbray): enable the fast loading and validation paths for this type |
| - // of file. |
| - PP_NaClFileInfo file_info; |
| file_info.handle = handle; |
| - file_info.token_lo = 0; |
| - file_info.token_hi = 0; |
| base::MessageLoop::current()->PostTask( |
| FROM_HERE, |
| base::Bind(callback, static_cast<int32_t>(PP_OK), file_info)); |
| @@ -1591,7 +1602,7 @@ const PPB_NaCl_Private nacl_interface = { |
| &UrandomFD, |
| &Are3DInterfacesDisabled, |
| &BrokerDuplicateHandle, |
| - &GetReadonlyPnaclFd, |
| + &GetReadExecPnaclFd, |
| &CreateTemporaryFile, |
| &GetNumberOfProcessors, |
| &PPIsNonSFIModeEnabled, |