| 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" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/platform_file.h" | 19 #include "base/platform_file.h" |
| 19 #include "base/posix/eintr_wrapper.h" | 20 #include "base/posix/eintr_wrapper.h" |
| 20 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
| 21 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 22 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 | 450 |
| 450 virtual bool FileExists(const std::string& fname) { | 451 virtual bool FileExists(const std::string& fname) { |
| 451 return ::file_util::PathExists(CreateFilePath(fname)); | 452 return ::file_util::PathExists(CreateFilePath(fname)); |
| 452 } | 453 } |
| 453 | 454 |
| 454 virtual Status GetChildren(const std::string& dir, | 455 virtual Status GetChildren(const std::string& dir, |
| 455 std::vector<std::string>* result) { | 456 std::vector<std::string>* result) { |
| 456 result->clear(); | 457 result->clear(); |
| 457 ::file_util::FileEnumerator iter( | 458 base::FileEnumerator iter( |
| 458 CreateFilePath(dir), false, ::file_util::FileEnumerator::FILES); | 459 CreateFilePath(dir), false, base::FileEnumerator::FILES); |
| 459 base::FilePath current = iter.Next(); | 460 base::FilePath current = iter.Next(); |
| 460 while (!current.empty()) { | 461 while (!current.empty()) { |
| 461 result->push_back(FilePathToString(current.BaseName())); | 462 result->push_back(FilePathToString(current.BaseName())); |
| 462 current = iter.Next(); | 463 current = iter.Next(); |
| 463 } | 464 } |
| 464 // TODO(jorlow): Unfortunately, the FileEnumerator swallows errors, so | 465 // TODO(jorlow): Unfortunately, the FileEnumerator swallows errors, so |
| 465 // we'll always return OK. Maybe manually check for error | 466 // we'll always return OK. Maybe manually check for error |
| 466 // conditions like the file not existing? | 467 // conditions like the file not existing? |
| 467 return Status::OK(); | 468 return Status::OK(); |
| 468 } | 469 } |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 826 |
| 826 Env* IDBEnv() { | 827 Env* IDBEnv() { |
| 827 return idb_env.Pointer(); | 828 return idb_env.Pointer(); |
| 828 } | 829 } |
| 829 | 830 |
| 830 Env* Env::Default() { | 831 Env* Env::Default() { |
| 831 return default_env.Pointer(); | 832 return default_env.Pointer(); |
| 832 } | 833 } |
| 833 | 834 |
| 834 } | 835 } |
| OLD | NEW |