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/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
21 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
22 #include "base/threading/platform_thread.h" | 23 #include "base/threading/platform_thread.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 584 } |
584 } | 585 } |
585 | 586 |
586 bool ChromiumEnv::FileExists(const std::string& fname) { | 587 bool ChromiumEnv::FileExists(const std::string& fname) { |
587 return ::file_util::PathExists(CreateFilePath(fname)); | 588 return ::file_util::PathExists(CreateFilePath(fname)); |
588 } | 589 } |
589 | 590 |
590 Status ChromiumEnv::GetChildren(const std::string& dir, | 591 Status ChromiumEnv::GetChildren(const std::string& dir, |
591 std::vector<std::string>* result) { | 592 std::vector<std::string>* result) { |
592 result->clear(); | 593 result->clear(); |
593 ::file_util::FileEnumerator iter( | 594 base::FileEnumerator iter( |
594 CreateFilePath(dir), false, ::file_util::FileEnumerator::FILES); | 595 CreateFilePath(dir), false, base::FileEnumerator::FILES); |
595 base::FilePath current = iter.Next(); | 596 base::FilePath current = iter.Next(); |
596 while (!current.empty()) { | 597 while (!current.empty()) { |
597 result->push_back(FilePathToString(current.BaseName())); | 598 result->push_back(FilePathToString(current.BaseName())); |
598 current = iter.Next(); | 599 current = iter.Next(); |
599 } | 600 } |
600 // TODO(jorlow): Unfortunately, the FileEnumerator swallows errors, so | 601 // TODO(jorlow): Unfortunately, the FileEnumerator swallows errors, so |
601 // we'll always return OK. Maybe manually check for error | 602 // we'll always return OK. Maybe manually check for error |
602 // conditions like the file not existing? | 603 // conditions like the file not existing? |
603 return Status::OK(); | 604 return Status::OK(); |
604 } | 605 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 Env* IDBEnv() { | 943 Env* IDBEnv() { |
943 return leveldb_env::idb_env.Pointer(); | 944 return leveldb_env::idb_env.Pointer(); |
944 } | 945 } |
945 | 946 |
946 Env* Env::Default() { | 947 Env* Env::Default() { |
947 return leveldb_env::default_env.Pointer(); | 948 return leveldb_env::default_env.Pointer(); |
948 } | 949 } |
949 | 950 |
950 } // namespace leveldb | 951 } // namespace leveldb |
951 | 952 |
OLD | NEW |