Chromium Code Reviews| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 // TODO(jorlow): Should we assert this is a file? | 590 // TODO(jorlow): Should we assert this is a file? |
| 591 if (!::file_util::Delete(CreateFilePath(fname), false)) { | 591 if (!::file_util::Delete(CreateFilePath(fname), false)) { |
| 592 result = MakeIOError(fname, "Could not delete file.", kDeleteFile); | 592 result = MakeIOError(fname, "Could not delete file.", kDeleteFile); |
| 593 RecordErrorAt(kDeleteFile); | 593 RecordErrorAt(kDeleteFile); |
| 594 } | 594 } |
| 595 return result; | 595 return result; |
| 596 } | 596 } |
| 597 | 597 |
| 598 Status ChromiumEnv::CreateDir(const std::string& name) { | 598 Status ChromiumEnv::CreateDir(const std::string& name) { |
| 599 Status result; | 599 Status result; |
| 600 if (!::file_util::CreateDirectory(CreateFilePath(name))) { | 600 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
| 601 result = MakeIOError(name, "Could not create directory.", kCreateDir); | 601 Retrier retrier(kCreateDir, this); |
| 602 RecordErrorAt(kCreateDir); | 602 do { |
| 603 } | 603 if (::file_util::CreateDirectoryAndGetError(CreateFilePath(name), &error)) { |
| 604 return result; | |
| 605 } | |
|
jar (doing other things)
2013/06/07 23:32:49
nit: No need for curlies around this one line resu
dgrogan
2013/06/07 23:35:50
Done.
| |
| 606 } while (retrier.ShouldKeepTrying(error)); | |
| 607 result = MakeIOError(name, "Could not create directory.", kCreateDir); | |
| 608 RecordErrorAt(kCreateDir); | |
| 604 return result; | 609 return result; |
| 605 } | 610 } |
| 606 | 611 |
| 607 Status ChromiumEnv::DeleteDir(const std::string& name) { | 612 Status ChromiumEnv::DeleteDir(const std::string& name) { |
| 608 Status result; | 613 Status result; |
| 609 // TODO(jorlow): Should we assert this is a directory? | 614 // TODO(jorlow): Should we assert this is a directory? |
| 610 if (!::file_util::Delete(CreateFilePath(name), false)) { | 615 if (!::file_util::Delete(CreateFilePath(name), false)) { |
| 611 result = MakeIOError(name, "Could not delete directory.", kDeleteDir); | 616 result = MakeIOError(name, "Could not delete directory.", kDeleteDir); |
| 612 RecordErrorAt(kDeleteDir); | 617 RecordErrorAt(kDeleteDir); |
| 613 } | 618 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 Env* IDBEnv() { | 919 Env* IDBEnv() { |
| 915 return leveldb_env::idb_env.Pointer(); | 920 return leveldb_env::idb_env.Pointer(); |
| 916 } | 921 } |
| 917 | 922 |
| 918 Env* Env::Default() { | 923 Env* Env::Default() { |
| 919 return leveldb_env::default_env.Pointer(); | 924 return leveldb_env::default_env.Pointer(); |
| 920 } | 925 } |
| 921 | 926 |
| 922 } // namespace leveldb | 927 } // namespace leveldb |
| 923 | 928 |
| OLD | NEW |