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.
5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_WIN_H_
6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_WIN_H_
11 #include "third_party/leveldatabase/env_chromium.h"
13 namespace leveldb_env
{
15 leveldb::Status
MakeIOErrorWin(leveldb::Slice filename
,
16 const std::string
& message
,
20 class ChromiumWritableFileWin
: public leveldb::WritableFile
{
22 ChromiumWritableFileWin(const std::string
& fname
,
24 const UMALogger
* uma_logger
,
25 WriteTracker
* tracker
,
27 virtual ~ChromiumWritableFileWin();
28 virtual leveldb::Status
Append(const leveldb::Slice
& data
);
29 virtual leveldb::Status
Close();
30 virtual leveldb::Status
Flush();
31 virtual leveldb::Status
Sync();
39 leveldb::Status
SyncParent();
41 std::string filename_
;
43 const UMALogger
* uma_logger_
;
44 WriteTracker
* tracker_
;
46 std::string parent_dir_
;
50 class ChromiumEnvWin
: public ChromiumEnv
{
53 virtual ~ChromiumEnvWin();
55 virtual leveldb::Status
NewSequentialFile(const std::string
& fname
,
56 leveldb::SequentialFile
** result
);
57 virtual leveldb::Status
NewRandomAccessFile(
58 const std::string
& fname
,
59 leveldb::RandomAccessFile
** result
);
60 virtual leveldb::Status
NewWritableFile(const std::string
& fname
,
61 leveldb::WritableFile
** result
);
62 virtual leveldb::Status
NewLogger(const std::string
& fname
,
63 leveldb::Logger
** result
);
66 virtual base::File::Error
GetDirectoryEntries(
67 const base::FilePath
& dir_param
,
68 std::vector
<base::FilePath
>* result
) const;
71 // BGThread() is the body of the background thread
73 static void BGThreadWrapper(void* arg
) {
74 reinterpret_cast<ChromiumEnvWin
*>(arg
)->BGThread();
76 void RecordOpenFilesLimit(const std::string
& type
);
77 virtual void RecordOSError(MethodID method
, DWORD err
) const;
80 } // namespace leveldb_env
82 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_WIN_H_