diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 10:02:09 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 10:02:09 +0000 |
commit | 20d064e9c08f1d421d66b2955f3230a43c840d77 (patch) | |
tree | 7d24cd0a02c620e20dc0cca21c4da69ba8ccfac3 /webkit/browser | |
parent | 2aa0f09e903f75a898bc00480459472da7e2969d (diff) | |
download | chromium_src-20d064e9c08f1d421d66b2955f3230a43c840d77.zip chromium_src-20d064e9c08f1d421d66b2955f3230a43c840d77.tar.gz chromium_src-20d064e9c08f1d421d66b2955f3230a43c840d77.tar.bz2 |
Stop using net::FileStream synchronously in native_file_util.cc
Use base::File instead.
BUG=351823
TEST=content_unittests
Review URL: https://codereview.chromium.org/196103012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
-rw-r--r-- | webkit/browser/fileapi/native_file_util.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc index e99e297..8f4560b 100644 --- a/webkit/browser/fileapi/native_file_util.cc +++ b/webkit/browser/fileapi/native_file_util.cc @@ -5,9 +5,9 @@ #include "webkit/browser/fileapi/native_file_util.h" #include "base/file_util.h" +#include "base/files/file.h" #include "base/files/file_enumerator.h" #include "base/memory/scoped_ptr.h" -#include "net/base/file_stream.h" #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_url.h" @@ -37,15 +37,14 @@ bool SetPlatformSpecificDirectoryPermissions(const base::FilePath& dir_path) { // Copies a file |from| to |to|, and ensure the written content is synced to // the disk. This is essentially base::CopyFile followed by fsync(). bool CopyFileAndSync(const base::FilePath& from, const base::FilePath& to) { - net::FileStream infile(NULL); - if (infile.OpenSync(from, - base::PLATFORM_FILE_OPEN | base:: PLATFORM_FILE_READ) < 0) { + base::File infile(from, base::File::FLAG_OPEN | base::File::FLAG_READ); + if (!infile.IsValid()) { return false; } - net::FileStream outfile(NULL); - if (outfile.OpenSync(to, - base::PLATFORM_FILE_CREATE_ALWAYS | base:: PLATFORM_FILE_WRITE) < 0) { + base::File outfile(to, + base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); + if (!outfile.IsValid()) { return false; } @@ -53,21 +52,21 @@ bool CopyFileAndSync(const base::FilePath& from, const base::FilePath& to) { std::vector<char> buffer(kBufferSize); for (;;) { - int bytes_read = infile.ReadSync(&buffer[0], kBufferSize); + int bytes_read = infile.ReadAtCurrentPos(&buffer[0], kBufferSize); if (bytes_read < 0) return false; if (bytes_read == 0) break; for (int bytes_written = 0; bytes_written < bytes_read; ) { - int bytes_written_partial = outfile.WriteSync(&buffer[bytes_written], - bytes_read - bytes_written); + int bytes_written_partial = outfile.WriteAtCurrentPos( + &buffer[bytes_written], bytes_read - bytes_written); if (bytes_written_partial < 0) return false; bytes_written += bytes_written_partial; } } - return outfile.FlushSync() >= 0; + return outfile.Flush(); } } // namespace |