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

Unified Diff: third_party/leveldatabase/env_chromium.cc

Issue 805043006: IndexedDB: ParseMethodAndError takes a leveldb::Status instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/leveldatabase/env_chromium.h ('k') | third_party/leveldatabase/env_chromium_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/leveldatabase/env_chromium.cc
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index cad20412bb343f5abf69b9eb7cc27b6448814e7b..05151b958172388dd4f382e08f09b80ab6dc225f 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -408,22 +408,23 @@ Status MakeIOError(Slice filename,
return Status::IOError(filename, buf);
}
-ErrorParsingResult ParseMethodAndError(const char* string,
+ErrorParsingResult ParseMethodAndError(const leveldb::Status& status,
MethodID* method_param,
int* error) {
+ std::string str = status.ToString();
dgrogan 2014/12/15 21:55:30 Change the variable name so status_string, or some
cmumford 2014/12/15 22:26:11 I renamed it to "status_string". I couldn't make i
dgrogan 2014/12/15 22:31:48 I think you understood it but now I'm confused. Wo
int method;
- if (RE2::PartialMatch(string, "ChromeMethodOnly: (\\d+)", &method)) {
+ if (RE2::PartialMatch(str.c_str(), "ChromeMethodOnly: (\\d+)", &method)) {
*method_param = static_cast<MethodID>(method);
return METHOD_ONLY;
}
- if (RE2::PartialMatch(
- string, "ChromeMethodPFE: (\\d+)::.*::(\\d+)", &method, error)) {
+ if (RE2::PartialMatch(str.c_str(), "ChromeMethodPFE: (\\d+)::.*::(\\d+)",
+ &method, error)) {
*error = -*error;
*method_param = static_cast<MethodID>(method);
return METHOD_AND_PFE;
}
- if (RE2::PartialMatch(
- string, "ChromeMethodErrno: (\\d+)::.*::(\\d+)", &method, error)) {
+ if (RE2::PartialMatch(str.c_str(), "ChromeMethodErrno: (\\d+)::.*::(\\d+)",
+ &method, error)) {
*method_param = static_cast<MethodID>(method);
return METHOD_AND_ERRNO;
}
@@ -502,8 +503,8 @@ bool IndicatesDiskFull(const leveldb::Status& status) {
return false;
leveldb_env::MethodID method;
int error = -1;
- leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError(
- status.ToString().c_str(), &method, &error);
+ leveldb_env::ErrorParsingResult result =
+ leveldb_env::ParseMethodAndError(status, &method, &error);
return (result == leveldb_env::METHOD_AND_PFE &&
static_cast<base::File::Error>(error) ==
base::File::FILE_ERROR_NO_SPACE) ||
@@ -513,8 +514,8 @@ bool IndicatesDiskFull(const leveldb::Status& status) {
bool IsIOError(const leveldb::Status& status) {
leveldb_env::MethodID method;
int error = -1;
- leveldb_env::ErrorParsingResult result = leveldb_env::ParseMethodAndError(
- status.ToString().c_str(), &method, &error);
+ leveldb_env::ErrorParsingResult result =
+ leveldb_env::ParseMethodAndError(status, &method, &error);
return result != leveldb_env::NONE;
}
« no previous file with comments | « third_party/leveldatabase/env_chromium.h ('k') | third_party/leveldatabase/env_chromium_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698