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

Unified Diff: base/file_util_proxy.cc

Issue 3604006: Revert 61462 - Add truncate and cancel for FileWriter; write and more tests w... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « base/file_util_proxy.h ('k') | chrome/browser/file_system/file_system_dispatcher_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_proxy.cc
===================================================================
--- base/file_util_proxy.cc (revision 61462)
+++ base/file_util_proxy.cc (working copy)
@@ -498,7 +498,7 @@
class RelayWrite : public MessageLoopRelay {
public:
RelayWrite(base::PlatformFile file,
- int64 offset,
+ long long offset,
const char* buffer,
int bytes_to_write,
base::FileUtilProxy::ReadWriteCallback* callback)
@@ -582,11 +582,11 @@
base::Time last_modified_time_;
};
-class RelayTruncatePlatformFile : public RelayWithStatusCallback {
+class RelayTruncate : public RelayWithStatusCallback {
public:
- RelayTruncatePlatformFile(base::PlatformFile file,
- int64 length,
- base::FileUtilProxy::StatusCallback* callback)
+ RelayTruncate(base::PlatformFile file,
+ int64 length,
+ base::FileUtilProxy::StatusCallback* callback)
: RelayWithStatusCallback(callback),
file_(file),
length_(length) {
@@ -603,39 +603,6 @@
int64 length_;
};
-class RelayTruncate : public RelayWithStatusCallback {
- public:
- RelayTruncate(const FilePath& path,
- int64 length,
- base::FileUtilProxy::StatusCallback* callback)
- : RelayWithStatusCallback(callback),
- path_(path),
- length_(length) {
- }
-
- protected:
- virtual void RunWork() {
- base::PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED);
- base::PlatformFile file =
- base::CreatePlatformFile(
- path_,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
- NULL,
- &error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
- set_error_code(error_code);
- return;
- }
- if (!base::TruncatePlatformFile(file, length_))
- set_error_code(base::PLATFORM_FILE_ERROR_FAILED);
- base::ClosePlatformFile(file);
- }
-
- private:
- FilePath path_;
- int64 length_;
-};
-
class RelayFlush : public RelayWithStatusCallback {
public:
RelayFlush(base::PlatformFile file,
@@ -815,23 +782,13 @@
bool FileUtilProxy::Truncate(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
PlatformFile file,
- int64 length,
+ long long length,
StatusCallback* callback) {
return Start(FROM_HERE, message_loop_proxy,
- new RelayTruncatePlatformFile(file, length, callback));
+ new RelayTruncate(file, length, callback));
}
// static
-bool FileUtilProxy::Truncate(
- scoped_refptr<MessageLoopProxy> message_loop_proxy,
- const FilePath& path,
- int64 length,
- StatusCallback* callback) {
- return Start(FROM_HERE, message_loop_proxy,
- new RelayTruncate(path, length, callback));
-}
-
-// static
bool FileUtilProxy::Flush(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
PlatformFile file,
« no previous file with comments | « base/file_util_proxy.h ('k') | chrome/browser/file_system/file_system_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698