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 ce7fe30b2046f58b4348926d3560e0e40673ccfd..4cdd1948404735b429a816a54c57726da586f7b3 100644 |
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc |
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc |
@@ -5,6 +5,7 @@ |
#include "native_client/src/trusted/plugin/file_downloader.h" |
#include <stdio.h> |
+#include <string.h> |
#include <string> |
#include "native_client/src/include/portability_io.h" |
@@ -145,7 +146,8 @@ bool FileDownloader::Open( |
} |
void FileDownloader::OpenFast(const nacl::string& url, |
- PP_FileHandle file_handle) { |
+ PP_FileHandle file_handle, |
+ uint64_t nonce) { |
PLUGIN_PRINTF(("FileDownloader::OpenFast (url=%s)\n", url.c_str())); |
CHECK(instance_ != NULL); |
open_time_ = NaClGetTimeOfDayMicroseconds(); |
@@ -154,9 +156,13 @@ void FileDownloader::OpenFast(const nacl::string& url, |
url_ = url; |
mode_ = DOWNLOAD_NONE; |
file_handle_ = file_handle; |
+ nonce_ = nonce; |
} |
-int32_t FileDownloader::GetPOSIXFileDescriptor() { |
+struct NaClFileInfo FileDownloader::GetFileInfo() { |
+ struct NaClFileInfo info; |
+ memset(&info, 0, sizeof(info)); |
+ info.desc = -1; |
int32_t file_desc = NACL_NO_FILE_DESC; |
if (not_streaming() && file_handle_ != PP_kInvalidFileHandle) { |
#if NACL_WINDOWS |
@@ -165,13 +171,14 @@ int32_t FileDownloader::GetPOSIXFileDescriptor() { |
#else |
file_desc = file_handle_; |
#endif |
+ info.nonce = nonce_; |
} else { |
if (!streaming_to_file()) { |
- return NACL_NO_FILE_DESC; |
+ return info; |
dmichael (off chromium)
2013/05/15 18:37:53
I find these error returns less obvious now. Not s
Nick Bray (chromium)
2013/05/16 16:38:17
The file info structure is defined in the NaCl rep
dmichael (off chromium)
2013/05/16 17:08:35
How about a simple little helper function in the u
Nick Bray (chromium)
2013/05/16 17:44:15
Didn't think of that one. Good idea. Done.
|
} |
// Use the trusted interface to get the file descriptor. |
if (file_io_trusted_interface_ == NULL) { |
- return NACL_NO_FILE_DESC; |
+ return info; |
} |
file_desc = file_io_trusted_interface_->GetOSFileDescriptor( |
file_reader_.pp_resource()); |
@@ -183,12 +190,13 @@ int32_t FileDownloader::GetPOSIXFileDescriptor() { |
if (posix_desc == -1) { |
// Close the Windows HANDLE if it can't be converted. |
CloseHandle(reinterpret_cast<HANDLE>(file_desc)); |
- return NACL_NO_FILE_DESC; |
+ return info; |
} |
file_desc = posix_desc; |
#endif |
- return file_desc; |
+ info.desc = file_desc; |
+ return info; |
} |
int64_t FileDownloader::TimeSinceOpenMilliseconds() const { |