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

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, 1 month 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: webkit/glue/webfileutilities_impl.cc
diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc
index 835c37e87ce294aee3f48f46a40e064021759ada..b2eb1415929fdf47b0fd5c0f71a414d28c7c2193 100644
--- a/webkit/glue/webfileutilities_impl.cc
+++ b/webkit/glue/webfileutilities_impl.cc
@@ -118,16 +118,16 @@ long long WebFileUtilitiesImpl::seekFile(base::PlatformFile handle,
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,
@@ -135,10 +135,7 @@ int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle,
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,
@@ -146,8 +143,7 @@ int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle,
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

Powered by Google App Engine
This is Rietveld 408576698