| 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" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 // TODO(jorlow): Should we assert this is a file? | 609 // TODO(jorlow): Should we assert this is a file? |
| 610 if (!::file_util::Delete(CreateFilePath(fname), false)) { | 610 if (!::file_util::Delete(CreateFilePath(fname), false)) { |
| 611 result = MakeIOError(fname, "Could not delete file.", kDeleteFile); | 611 result = MakeIOError(fname, "Could not delete file.", kDeleteFile); |
| 612 RecordErrorAt(kDeleteFile); | 612 RecordErrorAt(kDeleteFile); |
| 613 } | 613 } |
| 614 return result; | 614 return result; |
| 615 } | 615 } |
| 616 | 616 |
| 617 Status ChromiumEnv::CreateDir(const std::string& name) { | 617 Status ChromiumEnv::CreateDir(const std::string& name) { |
| 618 Status result; | 618 Status result; |
| 619 if (!::file_util::CreateDirectory(CreateFilePath(name))) { | 619 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
| 620 result = MakeIOError(name, "Could not create directory.", kCreateDir); | 620 Retrier retrier(kCreateDir, this); |
| 621 RecordErrorAt(kCreateDir); | 621 do { |
| 622 } | 622 if (::file_util::CreateDirectoryAndGetError(CreateFilePath(name), &error)) |
| 623 return result; |
| 624 } while (retrier.ShouldKeepTrying(error)); |
| 625 result = MakeIOError(name, "Could not create directory.", kCreateDir); |
| 626 RecordErrorAt(kCreateDir); |
| 623 return result; | 627 return result; |
| 624 } | 628 } |
| 625 | 629 |
| 626 Status ChromiumEnv::DeleteDir(const std::string& name) { | 630 Status ChromiumEnv::DeleteDir(const std::string& name) { |
| 627 Status result; | 631 Status result; |
| 628 // TODO(jorlow): Should we assert this is a directory? | 632 // TODO(jorlow): Should we assert this is a directory? |
| 629 if (!::file_util::Delete(CreateFilePath(name), false)) { | 633 if (!::file_util::Delete(CreateFilePath(name), false)) { |
| 630 result = MakeIOError(name, "Could not delete directory.", kDeleteDir); | 634 result = MakeIOError(name, "Could not delete directory.", kDeleteDir); |
| 631 RecordErrorAt(kDeleteDir); | 635 RecordErrorAt(kDeleteDir); |
| 632 } | 636 } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 Env* IDBEnv() { | 947 Env* IDBEnv() { |
| 944 return leveldb_env::idb_env.Pointer(); | 948 return leveldb_env::idb_env.Pointer(); |
| 945 } | 949 } |
| 946 | 950 |
| 947 Env* Env::Default() { | 951 Env* Env::Default() { |
| 948 return leveldb_env::default_env.Pointer(); | 952 return leveldb_env::default_env.Pointer(); |
| 949 } | 953 } |
| 950 | 954 |
| 951 } // namespace leveldb | 955 } // namespace leveldb |
| 952 | 956 |
| OLD | NEW |