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

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

Issue 26045002: Don't reset the database when there was an I/O error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mark enum as deprecated Created 7 years, 2 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
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 leveldb_env::MethodID method; 385 leveldb_env::MethodID method;
386 int error = -1; 386 int error = -1;
387 leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError( 387 leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError(
388 status.ToString().c_str(), &method, &error); 388 status.ToString().c_str(), &method, &error);
389 return (result == leveldb_env::METHOD_AND_PFE && 389 return (result == leveldb_env::METHOD_AND_PFE &&
390 static_cast<base::PlatformFileError>(error) == 390 static_cast<base::PlatformFileError>(error) ==
391 base::PLATFORM_FILE_ERROR_NO_SPACE) || 391 base::PLATFORM_FILE_ERROR_NO_SPACE) ||
392 (result == leveldb_env::METHOD_AND_ERRNO && error == ENOSPC); 392 (result == leveldb_env::METHOD_AND_ERRNO && error == ENOSPC);
393 } 393 }
394 394
395 bool RecoveryCouldBeFruitful(leveldb::Status status) {
jsbell 2013/10/04 23:32:33 Could this be renamed now to StatusIsIOError or so
dgrogan 2013/10/05 01:06:16 Done.
396 leveldb_env::MethodID method;
397 int error = -1;
398 leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError(
399 status.ToString().c_str(), &method, &error);
400 return result == leveldb_env::NONE;
401 }
402
395 std::string FilePathToString(const base::FilePath& file_path) { 403 std::string FilePathToString(const base::FilePath& file_path) {
396 #if defined(OS_WIN) 404 #if defined(OS_WIN)
397 return UTF16ToUTF8(file_path.value()); 405 return UTF16ToUTF8(file_path.value());
398 #else 406 #else
399 return file_path.value(); 407 return file_path.value();
400 #endif 408 #endif
401 } 409 }
402 410
403 ChromiumWritableFile::ChromiumWritableFile(const std::string& fname, 411 ChromiumWritableFile::ChromiumWritableFile(const std::string& fname,
404 FILE* f, 412 FILE* f,
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 Env* IDBEnv() { 946 Env* IDBEnv() {
939 return leveldb_env::idb_env.Pointer(); 947 return leveldb_env::idb_env.Pointer();
940 } 948 }
941 949
942 Env* Env::Default() { 950 Env* Env::Default() {
943 return leveldb_env::default_env.Pointer(); 951 return leveldb_env::default_env.Pointer();
944 } 952 }
945 953
946 } // namespace leveldb 954 } // namespace leveldb
947 955
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698