| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 The LevelDB Authors. All rights reserved. | |
| 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. | |
| 4 | |
| 5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_WIN_H_ | |
| 6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_WIN_H_ | |
| 7 | |
| 8 #include "env_chromium.h" | |
| 9 | |
| 10 namespace leveldb_env { | |
| 11 | |
| 12 leveldb::Status MakeIOErrorWin(leveldb::Slice filename, | |
| 13 const std::string& message, | |
| 14 MethodID method, | |
| 15 DWORD err); | |
| 16 | |
| 17 class ChromiumWritableFileWin : public leveldb::WritableFile { | |
| 18 public: | |
| 19 ChromiumWritableFileWin(const std::string& fname, | |
| 20 HANDLE f, | |
| 21 const UMALogger* uma_logger, | |
| 22 WriteTracker* tracker, | |
| 23 bool make_backup); | |
| 24 virtual ~ChromiumWritableFileWin(); | |
| 25 virtual leveldb::Status Append(const leveldb::Slice& data); | |
| 26 virtual leveldb::Status Close(); | |
| 27 virtual leveldb::Status Flush(); | |
| 28 virtual leveldb::Status Sync(); | |
| 29 | |
| 30 private: | |
| 31 enum Type { | |
| 32 kManifest, | |
| 33 kTable, | |
| 34 kOther | |
| 35 }; | |
| 36 leveldb::Status SyncParent(); | |
| 37 | |
| 38 std::string filename_; | |
| 39 HANDLE file_; | |
| 40 const UMALogger* uma_logger_; | |
| 41 WriteTracker* tracker_; | |
| 42 Type file_type_; | |
| 43 std::string parent_dir_; | |
| 44 bool make_backup_; | |
| 45 }; | |
| 46 | |
| 47 class ChromiumEnvWin : public ChromiumEnv { | |
| 48 public: | |
| 49 ChromiumEnvWin(); | |
| 50 virtual ~ChromiumEnvWin(); | |
| 51 | |
| 52 virtual leveldb::Status NewSequentialFile(const std::string& fname, | |
| 53 leveldb::SequentialFile** result); | |
| 54 virtual leveldb::Status NewRandomAccessFile( | |
| 55 const std::string& fname, | |
| 56 leveldb::RandomAccessFile** result); | |
| 57 virtual leveldb::Status NewWritableFile(const std::string& fname, | |
| 58 leveldb::WritableFile** result); | |
| 59 virtual leveldb::Status NewLogger(const std::string& fname, | |
| 60 leveldb::Logger** result); | |
| 61 | |
| 62 protected: | |
| 63 virtual base::PlatformFileError GetDirectoryEntries( | |
| 64 const base::FilePath& dir_param, | |
| 65 std::vector<base::FilePath>* result) const; | |
| 66 | |
| 67 private: | |
| 68 // BGThread() is the body of the background thread | |
| 69 void BGThread(); | |
| 70 static void BGThreadWrapper(void* arg) { | |
| 71 reinterpret_cast<ChromiumEnvWin*>(arg)->BGThread(); | |
| 72 } | |
| 73 void RecordOpenFilesLimit(const std::string& type); | |
| 74 virtual void RecordOSError(MethodID method, DWORD err) const; | |
| 75 }; | |
| 76 | |
| 77 } // namespace leveldb_env | |
| 78 | |
| 79 #endif | |
| OLD | NEW |