| Index: components/nacl/loader/nacl_ipc_adapter.cc
|
| diff --git a/components/nacl/loader/nacl_ipc_adapter.cc b/components/nacl/loader/nacl_ipc_adapter.cc
|
| index 6cf2cc3e9a1a88656c12051821c788f13f4611eb..5df92fbe6adb4ef6e1bcf56b2bba334f19bc1469 100644
|
| --- a/components/nacl/loader/nacl_ipc_adapter.cc
|
| +++ b/components/nacl/loader/nacl_ipc_adapter.cc
|
| @@ -16,6 +16,7 @@
|
| #include "build/build_config.h"
|
| #include "ipc/ipc_channel.h"
|
| #include "ipc/ipc_platform_file.h"
|
| +#include "native_client/src/public/nacl_desc.h"
|
| #include "native_client/src/trusted/desc/nacl_desc_base.h"
|
| #include "native_client/src/trusted/desc/nacl_desc_custom.h"
|
| #include "native_client/src/trusted/desc/nacl_desc_imc_shm.h"
|
| @@ -23,9 +24,7 @@
|
| #include "native_client/src/trusted/desc/nacl_desc_quota.h"
|
| #include "native_client/src/trusted/desc/nacl_desc_quota_interface.h"
|
| #include "native_client/src/trusted/desc/nacl_desc_sync_socket.h"
|
| -#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
|
| #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
|
| -#include "native_client/src/trusted/validator/rich_file_info.h"
|
| #include "ppapi/c/ppb_file_io.h"
|
| #include "ppapi/proxy/ppapi_messages.h"
|
| #include "ppapi/proxy/serialized_handle.h"
|
| @@ -665,33 +664,15 @@ void NaClIPCAdapter::OnFileTokenResolved(const IPC::Message& orig_msg,
|
| std::string file_path_str = file_path.AsUTF8Unsafe();
|
| base::PlatformFile handle =
|
| IPC::PlatformFileForTransitToPlatformFile(ipc_fd);
|
| - // The file token was resolved successfully, so we populate the new
|
| - // NaClDesc with that information.
|
| - char* alloc_file_path = static_cast<char*>(
|
| - malloc(file_path_str.length() + 1));
|
| - strcpy(alloc_file_path, file_path_str.c_str());
|
| - scoped_ptr<NaClDescWrapper> desc_wrapper(new NaClDescWrapper(
|
| - NaClDescIoDescFromHandleAllocCtor(handle, NACL_ABI_O_RDONLY)));
|
| -
|
| - // Mark the desc as OK for mapping as executable memory.
|
| - NaClDescMarkSafeForMmap(desc_wrapper->desc());
|
| -
|
| - // Provide metadata for validation.
|
| - struct NaClRichFileInfo info;
|
| - NaClRichFileInfoCtor(&info);
|
| - info.known_file = 1;
|
| - info.file_path = alloc_file_path; // Takes ownership.
|
| - info.file_path_length =
|
| - static_cast<uint32_t>(file_path_str.length());
|
| - NaClSetFileOriginInfo(desc_wrapper->desc(), &info);
|
| - NaClRichFileInfoDtor(&info);
|
|
|
| ppapi::proxy::SerializedHandle sh;
|
| sh.set_file_handle(ipc_fd, PP_FILEOPENFLAG_READ, 0);
|
| scoped_ptr<IPC::Message> new_msg = CreateOpenResourceReply(orig_msg, sh);
|
| scoped_refptr<RewrittenMessage> rewritten_msg(new RewrittenMessage);
|
|
|
| - rewritten_msg->AddDescriptor(desc_wrapper.release());
|
| + struct NaClDesc* desc =
|
| + NaClDescCreateWithFilePathMetadata(handle, file_path_str.c_str());
|
| + rewritten_msg->AddDescriptor(new NaClDescWrapper(desc));
|
| {
|
| base::AutoLock lock(lock_);
|
| SaveMessage(*new_msg, rewritten_msg.get());
|
|
|