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

Unified Diff: third_party/leveldatabase/env_chromium.cc

Issue 803603004: IndexedDB: Reusing leveldb logs when opening database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added implementation of leveldb::Env::NewAppendableFile 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
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..5231f1887e9852fc92661fb393d7612640a419c2 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -358,6 +358,8 @@ const char* MethodIDToString(MethodID method) {
return "NewRandomAccessFile";
case kNewWritableFile:
return "NewWritableFile";
+ case kNewAppendableFile:
+ return "NewAppendableFile";
case kDeleteFile:
return "DeleteFile";
case kCreateDir:
@@ -900,6 +902,23 @@ Status ChromiumEnv::NewWritableFile(const std::string& fname,
}
}
+Status ChromiumEnv::NewAppendableFile(const std::string& fname,
+ leveldb::WritableFile** result) {
+ *result = NULL;
+ FilePath path = FilePath::FromUTF8Unsafe(fname);
+ scoped_ptr<base::File> f(new base::File(
+ path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND));
+ if (!f->IsValid()) {
+ RecordErrorAt(kNewAppendableFile);
+ return MakeIOError(fname, "Unable to create appendable file",
+ kNewAppendableFile, f->error_details());
+ } else {
jsbell 2014/12/15 17:41:23 No need for else block, since previous returns. (
cmumford 2014/12/15 18:08:36 Done.
+ *result =
+ new ChromiumWritableFile(fname, f.release(), this, this, make_backup_);
+ return Status::OK();
+ }
+}
+
uint64_t ChromiumEnv::NowMicros() {
return base::TimeTicks::Now().ToInternalValue();
}
« third_party/leveldatabase/env_chromium.h ('K') | « third_party/leveldatabase/env_chromium.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698