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

Unified Diff: third_party/leveldatabase/env_chromium_posix.h

Issue 113373002: Unrevert r245135 "Created new Windows LevelDB environment." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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_posix.h
diff --git a/third_party/leveldatabase/env_chromium_posix.h b/third_party/leveldatabase/env_chromium_posix.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd00efbf12e5dd726cc8af1aa95ced45d220f678
--- /dev/null
+++ b/third_party/leveldatabase/env_chromium_posix.h
@@ -0,0 +1,78 @@
+// Copyright (c) 2013 The LevelDB Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file. See the AUTHORS file for names of contributors.
+
+#ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_POSIX_H_
+#define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_POSIX_H_
+
+#include "env_chromium.h"
+
+namespace leveldb_env {
+
+leveldb::Status MakeIOError(leveldb::Slice filename,
+ const char* message,
+ MethodID method,
+ int saved_errno);
+
+class ChromiumWritableFile : public leveldb::WritableFile {
+ public:
+ ChromiumWritableFile(const std::string& fname,
+ FILE* f,
+ const UMALogger* uma_logger,
+ WriteTracker* tracker,
+ bool make_backup);
+ virtual ~ChromiumWritableFile();
+ virtual leveldb::Status Append(const leveldb::Slice& data);
+ virtual leveldb::Status Close();
+ virtual leveldb::Status Flush();
+ virtual leveldb::Status Sync();
+
+ private:
+ enum Type {
+ kManifest,
+ kTable,
+ kOther
+ };
+ leveldb::Status SyncParent();
+
+ std::string filename_;
+ FILE* file_;
+ const UMALogger* uma_logger_;
+ WriteTracker* tracker_;
+ Type file_type_;
+ std::string parent_dir_;
+ bool make_backup_;
+};
+
+class ChromiumEnvPosix : public ChromiumEnv {
+ public:
+ ChromiumEnvPosix();
+ virtual ~ChromiumEnvPosix();
+
+ virtual leveldb::Status NewSequentialFile(const std::string& fname,
+ leveldb::SequentialFile** result);
+ virtual leveldb::Status NewRandomAccessFile(
+ const std::string& fname,
+ leveldb::RandomAccessFile** result);
+ virtual leveldb::Status NewWritableFile(const std::string& fname,
+ leveldb::WritableFile** result);
+ virtual leveldb::Status NewLogger(const std::string& fname,
+ leveldb::Logger** result);
+
+ protected:
+ virtual base::PlatformFileError GetDirectoryEntries(
+ const base::FilePath& dir_param,
+ std::vector<base::FilePath>* result) const;
+
+ private:
+ // BGThread() is the body of the background thread
+ void BGThread();
+ static void BGThreadWrapper(void* arg) {
+ reinterpret_cast<ChromiumEnvPosix*>(arg)->BGThread();
+ }
+ void RecordOpenFilesLimit(const std::string& type);
+};
+
+} // namespace leveldb_env
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698