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

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

Issue 294633003: Pepper: Move StreamAsFile out of trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for bbudge Created 6 years, 7 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
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 cc25d28a1cd4fc940d974782ba7347c4ae8c3769..4a1b6ad16effbd5d7706cd13ab0d5635da4f565a 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
@@ -30,26 +30,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 {
@@ -175,37 +155,6 @@ bool FileDownloader::Open(
return true;
}
-void FileDownloader::OpenFast(const nacl::string& url,
- PP_FileHandle file_handle,
- uint64_t file_token_lo, uint64_t file_token_hi) {
- PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str()));
-
- file_info_.FreeResources();
- CHECK(instance_ != NULL);
- status_code_ = NACL_HTTP_STATUS_OK;
- url_ = url;
- mode_ = DOWNLOAD_NONE;
- if (file_handle != PP_kInvalidFileHandle) {
- NaClFileInfo tmp_info = NoFileInfo();
- tmp_info.desc = ConvertFileDescriptor(file_handle, true);
- tmp_info.file_token.lo = file_token_lo;
- tmp_info.file_token.hi = file_token_hi;
- file_info_.TakeOwnership(&tmp_info);
- }
-}
-
-NaClFileInfo FileDownloader::GetFileInfo() {
- NaClFileInfo info_to_return = NoFileInfo();
-
- PLUGIN_PRINTF(("FileDownloader::GetFileInfo, this %p\n", this));
- if (file_info_.get_desc() != -1) {
- info_to_return = file_info_.Release();
- }
- PLUGIN_PRINTF(("FileDownloader::GetFileInfo -- returning %d\n",
- info_to_return.desc));
- return info_to_return;
-}
-
bool FileDownloader::InitialResponseIsValid() {
// Process the response, validating the headers to confirm successful loading.
url_response_ = url_loader_.GetResponseInfo();
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/file_downloader.h ('k') | ppapi/native_client/src/trusted/plugin/plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698