| 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 "third_party/leveldatabase/env_chromium.h" | 5 #include "third_party/leveldatabase/env_chromium.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <dirent.h> | 8 #include <dirent.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #endif | 10 #endif |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 kNewWritableFile, f->error_details()); | 889 kNewWritableFile, f->error_details()); |
| 890 } else { | 890 } else { |
| 891 *result = | 891 *result = |
| 892 new ChromiumWritableFile(fname, f.release(), this, this, make_backup_); | 892 new ChromiumWritableFile(fname, f.release(), this, this, make_backup_); |
| 893 return Status::OK(); | 893 return Status::OK(); |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 | 896 |
| 897 Status ChromiumEnv::NewAppendableFile(const std::string& fname, | 897 Status ChromiumEnv::NewAppendableFile(const std::string& fname, |
| 898 leveldb::WritableFile** result) { | 898 leveldb::WritableFile** result) { |
| 899 #if defined(OS_CHROMEOS) | |
| 900 // Disabled until crbug.com/460568 is fixed. Technically this method shouldn't | |
| 901 // be called if reuse_logs is false, but a leveldb bug (fixed, but not yet in | |
| 902 // Chrome) still calls this function. Using default leveldb Env implementation | |
| 903 // to workaround this bug. | |
| 904 return Env::NewAppendableFile(fname, result); | |
| 905 #endif | |
| 906 | |
| 907 *result = NULL; | 899 *result = NULL; |
| 908 FilePath path = FilePath::FromUTF8Unsafe(fname); | 900 FilePath path = FilePath::FromUTF8Unsafe(fname); |
| 909 scoped_ptr<base::File> f(new base::File( | 901 scoped_ptr<base::File> f(new base::File( |
| 910 path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND)); | 902 path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND)); |
| 911 if (!f->IsValid()) { | 903 if (!f->IsValid()) { |
| 912 RecordErrorAt(kNewAppendableFile); | 904 RecordErrorAt(kNewAppendableFile); |
| 913 return MakeIOError(fname, "Unable to create appendable file", | 905 return MakeIOError(fname, "Unable to create appendable file", |
| 914 kNewAppendableFile, f->error_details()); | 906 kNewAppendableFile, f->error_details()); |
| 915 } | 907 } |
| 916 *result = | 908 *result = |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1096 |
| 1105 Env* IDBEnv() { | 1097 Env* IDBEnv() { |
| 1106 return leveldb_env::idb_env.Pointer(); | 1098 return leveldb_env::idb_env.Pointer(); |
| 1107 } | 1099 } |
| 1108 | 1100 |
| 1109 Env* Env::Default() { | 1101 Env* Env::Default() { |
| 1110 return leveldb_env::default_env.Pointer(); | 1102 return leveldb_env::default_env.Pointer(); |
| 1111 } | 1103 } |
| 1112 | 1104 |
| 1113 } // namespace leveldb | 1105 } // namespace leveldb |
| OLD | NEW |