diff options
author | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 22:02:36 +0000 |
---|---|---|
committer | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 22:02:36 +0000 |
commit | 6f539941a6cb93d3630bdb9b4d459cfde6988b71 (patch) | |
tree | 63c5c438d9e373fb79a51faa89d383a301b5307e /third_party | |
parent | 3264d16a00887b248d4828dbf136b3d8db8381a6 (diff) | |
download | chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.zip chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.tar.gz chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.tar.bz2 |
Make base:ReplaceFile return an informative error.
It currently just returns true/false to indicate success.
More information to diagnose and log failures would be
helpful in IndexedDB.
This patch also logs the new error when ReplaceFile fails in
IndexedDB.
BUG=229268
Review URL: https://chromiumcodereview.appspot.com/14886003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/leveldatabase/env_chromium.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index a512e31..ee19ba1 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -202,7 +202,7 @@ static const base::FilePath::CharType kLevelDBTestDirectoryPrefix[] const char* PlatformFileErrorString(const ::base::PlatformFileError& error) { switch (error) { case ::base::PLATFORM_FILE_ERROR_FAILED: - return "Opening file failed."; + return "No further details."; case ::base::PLATFORM_FILE_ERROR_IN_USE: return "File currently in use."; case ::base::PLATFORM_FILE_ERROR_EXISTS: @@ -549,8 +549,10 @@ class ChromiumEnv : public Env, public UMALogger { base::FilePath destination = CreateFilePath(dst); Retrier retrier(GetRetryTimeHistogram(kRenameFile), kMaxRenameTimeMillis); + base::PlatformFileError error = base::PLATFORM_FILE_OK; do { - if (::file_util::ReplaceFile(src_file_path, destination)) { + if (::file_util::ReplaceFileAndGetError( + src_file_path, destination, &error)) { sync_parent(dst); if (src != dst) sync_parent(src); @@ -558,8 +560,12 @@ class ChromiumEnv : public Env, public UMALogger { } } while (retrier.ShouldKeepTrying()); - RecordErrorAt(kRenameFile); - return Status::IOError(src, "Could not rename file."); + DCHECK(error != base::PLATFORM_FILE_OK); + RecordOSError(kRenameFile, error); + char buf[100]; + snprintf(buf, sizeof(buf), "Could not rename file: %s", + PlatformFileErrorString(error)); + return Status::IOError(src, buf); } virtual Status LockFile(const std::string& fname, FileLock** lock) { |