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

Unified Diff: webkit/blob/local_file_reader.cc

Issue 10038019: Add FileReader interface and implement FileSystemFileReader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 | « webkit/blob/local_file_reader.h ('k') | webkit/fileapi/file_system_file_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/local_file_reader.cc
diff --git a/webkit/blob/local_file_reader.cc b/webkit/blob/local_file_reader.cc
index c728a8bc9d104bbf9256ed6b12bc884271d1c48f..8948ac0c9ac3c480b6b7fdae23fab5a3c12a739c 100644
--- a/webkit/blob/local_file_reader.cc
+++ b/webkit/blob/local_file_reader.cc
@@ -21,19 +21,6 @@ const int kOpenFlagsForRead = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_ASYNC;
-int PlatformFileErrorToNetError(base::PlatformFileError file_error) {
- switch (file_error) {
- case base::PLATFORM_FILE_OK:
- return net::OK;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
- return net::ERR_FILE_NOT_FOUND;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
- return net::ERR_ACCESS_DENIED;
- default:
- return net::ERR_FAILED;
- }
-}
-
// Verify if the underlying file has not been modified.
bool VerifySnapshotTime(const base::Time& expected_modification_time,
const base::PlatformFileInfo& file_info) {
@@ -44,7 +31,6 @@ bool VerifySnapshotTime(const base::Time& expected_modification_time,
void DidGetFileInfoForGetLength(const net::Int64CompletionCallback& callback,
const base::Time& expected_modification_time,
- int64 initial_offset,
base::PlatformFileError error,
const base::PlatformFileInfo& file_info) {
if (file_info.is_directory) {
@@ -52,14 +38,14 @@ void DidGetFileInfoForGetLength(const net::Int64CompletionCallback& callback,
return;
}
if (error != base::PLATFORM_FILE_OK) {
- callback.Run(PlatformFileErrorToNetError(error));
+ callback.Run(LocalFileReader::PlatformFileErrorToNetError(error));
return;
}
if (!VerifySnapshotTime(expected_modification_time, file_info)) {
callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
return;
}
- callback.Run(file_info.size - initial_offset);
+ callback.Run(file_info.size);
}
void DidSeekFile(const LocalFileReader::OpenFileStreamCallback& callback,
@@ -78,6 +64,21 @@ void EmptyCompletionCallback(int) {}
} // namespace
+// static
+int LocalFileReader::PlatformFileErrorToNetError(
+ base::PlatformFileError file_error) {
+ switch (file_error) {
+ case base::PLATFORM_FILE_OK:
+ return net::OK;
+ case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ return net::ERR_FILE_NOT_FOUND;
+ case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
+ return net::ERR_ACCESS_DENIED;
+ default:
+ return net::ERR_FAILED;
+ }
+}
+
// A helper class to open, verify and seek a file stream for a given path.
class LocalFileReader::OpenFileStreamHelper {
public:
@@ -173,7 +174,7 @@ int LocalFileReader::GetLength(const net::Int64CompletionCallback& callback) {
const bool posted = base::FileUtilProxy::GetFileInfo(
file_thread_proxy_, file_path_,
base::Bind(&DidGetFileInfoForGetLength, callback,
- expected_modification_time_, initial_offset_));
+ expected_modification_time_));
DCHECK(posted);
return net::ERR_IO_PENDING;
}
« no previous file with comments | « webkit/blob/local_file_reader.h ('k') | webkit/fileapi/file_system_file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698