| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 FilePath original_table_name = FilePath::FromUTF8Unsafe(fname); | 502 FilePath original_table_name = FilePath::FromUTF8Unsafe(fname); |
| 503 FilePath backup_table_name = | 503 FilePath backup_table_name = |
| 504 original_table_name.ReplaceExtension(backup_table_extension); | 504 original_table_name.ReplaceExtension(backup_table_extension); |
| 505 return base::CopyFile(original_table_name, backup_table_name); | 505 return base::CopyFile(original_table_name, backup_table_name); |
| 506 } | 506 } |
| 507 | 507 |
| 508 ChromiumEnv::ChromiumEnv() | 508 ChromiumEnv::ChromiumEnv() |
| 509 : ChromiumEnv("LevelDBEnv", false /* make_backup */) {} | 509 : ChromiumEnv("LevelDBEnv", false /* make_backup */) {} |
| 510 | 510 |
| 511 ChromiumEnv::ChromiumEnv(const std::string& name, bool make_backup) | 511 ChromiumEnv::ChromiumEnv(const std::string& name, bool make_backup) |
| 512 : name_(name), | 512 : kMaxRetryTimeMillis(1000), |
| 513 name_(name), |
| 513 make_backup_(make_backup), | 514 make_backup_(make_backup), |
| 514 bgsignal_(&mu_), | 515 bgsignal_(&mu_), |
| 515 started_bgthread_(false), | 516 started_bgthread_(false) { |
| 516 kMaxRetryTimeMillis(1000) { | |
| 517 uma_ioerror_base_name_ = name_ + ".IOError.BFE"; | 517 uma_ioerror_base_name_ = name_ + ".IOError.BFE"; |
| 518 } | 518 } |
| 519 | 519 |
| 520 ChromiumEnv::~ChromiumEnv() { | 520 ChromiumEnv::~ChromiumEnv() { |
| 521 // In chromium, ChromiumEnv is leaked. It'd be nice to add NOTREACHED here to | 521 // In chromium, ChromiumEnv is leaked. It'd be nice to add NOTREACHED here to |
| 522 // ensure that behavior isn't accidentally changed, but there's an instance in | 522 // ensure that behavior isn't accidentally changed, but there's an instance in |
| 523 // a unit test that is deleted. | 523 // a unit test that is deleted. |
| 524 } | 524 } |
| 525 | 525 |
| 526 bool ChromiumEnv::FileExists(const std::string& fname) { | 526 bool ChromiumEnv::FileExists(const std::string& fname) { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1061 |
| 1062 } // namespace leveldb_env | 1062 } // namespace leveldb_env |
| 1063 | 1063 |
| 1064 namespace leveldb { | 1064 namespace leveldb { |
| 1065 | 1065 |
| 1066 Env* Env::Default() { | 1066 Env* Env::Default() { |
| 1067 return leveldb_env::default_env.Pointer(); | 1067 return leveldb_env::default_env.Pointer(); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 } // namespace leveldb | 1070 } // namespace leveldb |
| OLD | NEW |