OLD | NEW |
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | 1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. See the AUTHORS file for names of contributors. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 Status ChromiumEnv::RenameFile(const std::string& src, const std::string& dst) { | 665 Status ChromiumEnv::RenameFile(const std::string& src, const std::string& dst) { |
666 Status result; | 666 Status result; |
667 base::FilePath src_file_path = CreateFilePath(src); | 667 base::FilePath src_file_path = CreateFilePath(src); |
668 if (!::file_util::PathExists(src_file_path)) | 668 if (!::file_util::PathExists(src_file_path)) |
669 return result; | 669 return result; |
670 base::FilePath destination = CreateFilePath(dst); | 670 base::FilePath destination = CreateFilePath(dst); |
671 | 671 |
672 Retrier retrier(kRenameFile, this); | 672 Retrier retrier(kRenameFile, this); |
673 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 673 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
674 do { | 674 do { |
675 if (::file_util::ReplaceFileAndGetError( | 675 if (base::ReplaceFile(src_file_path, destination, &error)) |
676 src_file_path, destination, &error)) { | |
677 return result; | 676 return result; |
678 } | |
679 } while (retrier.ShouldKeepTrying(error)); | 677 } while (retrier.ShouldKeepTrying(error)); |
680 | 678 |
681 DCHECK(error != base::PLATFORM_FILE_OK); | 679 DCHECK(error != base::PLATFORM_FILE_OK); |
682 RecordOSError(kRenameFile, error); | 680 RecordOSError(kRenameFile, error); |
683 char buf[100]; | 681 char buf[100]; |
684 snprintf(buf, | 682 snprintf(buf, |
685 sizeof(buf), | 683 sizeof(buf), |
686 "Could not rename file: %s", | 684 "Could not rename file: %s", |
687 PlatformFileErrorString(error)); | 685 PlatformFileErrorString(error)); |
688 return MakeIOError(src, buf, kRenameFile, error); | 686 return MakeIOError(src, buf, kRenameFile, error); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 Env* IDBEnv() { | 957 Env* IDBEnv() { |
960 return leveldb_env::idb_env.Pointer(); | 958 return leveldb_env::idb_env.Pointer(); |
961 } | 959 } |
962 | 960 |
963 Env* Env::Default() { | 961 Env* Env::Default() { |
964 return leveldb_env::default_env.Pointer(); | 962 return leveldb_env::default_env.Pointer(); |
965 } | 963 } |
966 | 964 |
967 } // namespace leveldb | 965 } // namespace leveldb |
968 | 966 |
OLD | NEW |