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

Unified Diff: webkit/glue/webfileutilities_impl.cc

Issue 10701050: net: Implement canceling of all async operations in FileStream. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
« net/base/file_stream_posix.cc ('K') | « net/base/file_stream_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webfileutilities_impl.cc
===================================================================
--- webkit/glue/webfileutilities_impl.cc (revision 147715)
+++ webkit/glue/webfileutilities_impl.cc (working copy)
@@ -116,16 +116,16 @@
int origin) {
if (handle == base::kInvalidPlatformFileValue)
return -1;
- net::FileStream file_stream(handle, 0, NULL);
- return file_stream.SeekSync(static_cast<net::Whence>(origin), offset);
+ return base::SeekPlatformFile(handle,
+ static_cast<base::PlatformFileWhence>(origin),
+ offset);
}
bool WebFileUtilitiesImpl::truncateFile(base::PlatformFile handle,
long long offset) {
if (handle == base::kInvalidPlatformFileValue || offset < 0)
return false;
- net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL);
- return file_stream.Truncate(offset) >= 0;
+ return base::TruncatePlatformFile(handle, offset);
}
int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle,
@@ -133,10 +133,7 @@
int length) {
if (handle == base::kInvalidPlatformFileValue || !data || length <= 0)
return -1;
- std::string buffer;
- buffer.resize(length);
- net::FileStream file_stream(handle, base::PLATFORM_FILE_READ, NULL);
- return file_stream.ReadSync(data, length);
+ return base::ReadPlatformFileCurPosNoBestEffort(handle, data, length);
}
int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle,
@@ -144,8 +141,7 @@
int length) {
if (handle == base::kInvalidPlatformFileValue || !data || length <= 0)
return -1;
- net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL);
- return file_stream.WriteSync(data, length);
+ return base::WritePlatformFileCurPosNoBestEffort(handle, data, length);
}
} // namespace webkit_glue
« net/base/file_stream_posix.cc ('K') | « net/base/file_stream_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698