Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Unified Diff: ppapi/native_client/src/trusted/plugin/file_downloader.cc

Issue 224803002: Enable mmap and identity-based validation caching on pnacl-{llc,ld}.nexe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix token handover for main nexe Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/DEPS ('k') | ppapi/native_client/src/trusted/plugin/file_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/file_downloader.cc
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
index 9bfe0e97369ea402a1cec9eae4d8ed7a5bc71cdc..e453f13777cda35af1601afcab746d034a682ee2 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
@@ -18,6 +18,7 @@
#include "ppapi/cpp/url_request_info.h"
#include "ppapi/cpp/url_response_info.h"
#include "ppapi/native_client/src/trusted/plugin/callback_source.h"
+#include "ppapi/native_client/src/trusted/plugin/file_utils.h"
#include "ppapi/native_client/src/trusted/plugin/plugin.h"
#include "ppapi/native_client/src/trusted/plugin/utility.h"
@@ -33,26 +34,6 @@ struct NaClFileInfo NoFileInfo() {
return info;
}
-// Converts a PP_FileHandle to a POSIX file descriptor.
-int32_t ConvertFileDescriptor(PP_FileHandle handle) {
- PLUGIN_PRINTF(("ConvertFileDescriptor, handle=%d\n", handle));
-#if NACL_WINDOWS
- int32_t file_desc = NACL_NO_FILE_DESC;
- // On Windows, valid handles are 32 bit unsigned integers so this is safe.
- file_desc = reinterpret_cast<uintptr_t>(handle);
- // Convert the Windows HANDLE from Pepper to a POSIX file descriptor.
- int32_t posix_desc = _open_osfhandle(file_desc, _O_RDWR | _O_BINARY);
- if (posix_desc == -1) {
- // Close the Windows HANDLE if it can't be converted.
- CloseHandle(reinterpret_cast<HANDLE>(file_desc));
- return -1;
- }
- return posix_desc;
-#else
- return handle;
-#endif
-}
-
} // namespace
namespace plugin {
@@ -217,7 +198,7 @@ void FileDownloader::OpenFast(const nacl::string& url,
mode_ = DOWNLOAD_NONE;
if (file_handle != PP_kInvalidFileHandle) {
NaClFileInfo tmp_info = NoFileInfo();
- tmp_info.desc = ConvertFileDescriptor(file_handle);
+ tmp_info.desc = file_utils::ConvertFileDescriptor(file_handle);
tmp_info.file_token.lo = file_token_lo;
tmp_info.file_token.hi = file_token_hi;
file_info_.TakeOwnership(&tmp_info);
@@ -469,7 +450,7 @@ void FileDownloader::GotFileHandleNotify(int32_t pp_error,
pp_error));
if (pp_error == PP_OK) {
NaClFileInfo tmp_info = NoFileInfo();
- tmp_info.desc = ConvertFileDescriptor(handle);
+ tmp_info.desc = file_utils::ConvertFileDescriptor(handle);
file_info_.TakeOwnership(&tmp_info);
}
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/DEPS ('k') | ppapi/native_client/src/trusted/plugin/file_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698