| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 IsIOError(leveldb::Status status) { |
| 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 Loading... |
| 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 |
| OLD | NEW |