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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 RecordErrorAt(kNewWritableFile); | 590 RecordErrorAt(kNewWritableFile); |
591 return MakeIOError( | 591 return MakeIOError( |
592 fname, strerror(saved_errno), kNewWritableFile, saved_errno); | 592 fname, strerror(saved_errno), kNewWritableFile, saved_errno); |
593 } else { | 593 } else { |
594 *result = new ChromiumWritableFile(fname, f, this, this); | 594 *result = new ChromiumWritableFile(fname, f, this, this); |
595 return Status::OK(); | 595 return Status::OK(); |
596 } | 596 } |
597 } | 597 } |
598 | 598 |
599 bool ChromiumEnv::FileExists(const std::string& fname) { | 599 bool ChromiumEnv::FileExists(const std::string& fname) { |
600 return ::file_util::PathExists(CreateFilePath(fname)); | 600 return ::base::PathExists(CreateFilePath(fname)); |
601 } | 601 } |
602 | 602 |
603 Status ChromiumEnv::GetChildren(const std::string& dir, | 603 Status ChromiumEnv::GetChildren(const std::string& dir, |
604 std::vector<std::string>* result) { | 604 std::vector<std::string>* result) { |
605 result->clear(); | 605 result->clear(); |
606 base::FileEnumerator iter( | 606 base::FileEnumerator iter( |
607 CreateFilePath(dir), false, base::FileEnumerator::FILES); | 607 CreateFilePath(dir), false, base::FileEnumerator::FILES); |
608 base::FilePath current = iter.Next(); | 608 base::FilePath current = iter.Next(); |
609 while (!current.empty()) { | 609 while (!current.empty()) { |
610 result->push_back(FilePathToString(current.BaseName())); | 610 result->push_back(FilePathToString(current.BaseName())); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 RecordErrorAt(kGetFileSize); | 658 RecordErrorAt(kGetFileSize); |
659 } else { | 659 } else { |
660 *size = static_cast<uint64_t>(signed_size); | 660 *size = static_cast<uint64_t>(signed_size); |
661 } | 661 } |
662 return s; | 662 return s; |
663 } | 663 } |
664 | 664 |
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 (!::base::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 (base::ReplaceFile(src_file_path, destination, &error)) | 675 if (base::ReplaceFile(src_file_path, destination, &error)) |
676 return result; | 676 return result; |
677 } while (retrier.ShouldKeepTrying(error)); | 677 } while (retrier.ShouldKeepTrying(error)); |
678 | 678 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 Env* IDBEnv() { | 957 Env* IDBEnv() { |
958 return leveldb_env::idb_env.Pointer(); | 958 return leveldb_env::idb_env.Pointer(); |
959 } | 959 } |
960 | 960 |
961 Env* Env::Default() { | 961 Env* Env::Default() { |
962 return leveldb_env::default_env.Pointer(); | 962 return leveldb_env::default_env.Pointer(); |
963 } | 963 } |
964 | 964 |
965 } // namespace leveldb | 965 } // namespace leveldb |
966 | 966 |
OLD | NEW |