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

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

Issue 15812007: Make file_util::CreateDirectory return an error, not just a bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call the right function on windows 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 | « base/file_util_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('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"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698