Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: third_party/leveldatabase/env_chromium.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/syncable/directory.h ('k') | third_party/zlib/google/zip.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/syncable/directory.h ('k') | third_party/zlib/google/zip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698