OLD | NEW |
1 // Copyright (c) 2013 The LevelDB Authors. All rights reserved. | 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 | 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. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // | 104 // |
105 // |disk_space| is the logical partition size (in bytes), and *not* available | 105 // |disk_space| is the logical partition size (in bytes), and *not* available |
106 // space. A value of -1 will return leveldb's default write buffer size. | 106 // space. A value of -1 will return leveldb's default write buffer size. |
107 extern size_t WriteBufferSize(int64_t disk_space); | 107 extern size_t WriteBufferSize(int64_t disk_space); |
108 | 108 |
109 class UMALogger { | 109 class UMALogger { |
110 public: | 110 public: |
111 virtual void RecordErrorAt(MethodID method) const = 0; | 111 virtual void RecordErrorAt(MethodID method) const = 0; |
112 virtual void RecordOSError(MethodID method, | 112 virtual void RecordOSError(MethodID method, |
113 base::File::Error error) const = 0; | 113 base::File::Error error) const = 0; |
| 114 virtual void RecordBytesRead(int amount) const = 0; |
| 115 virtual void RecordBytesWritten(int amount) const = 0; |
114 }; | 116 }; |
115 | 117 |
116 class RetrierProvider { | 118 class RetrierProvider { |
117 public: | 119 public: |
118 virtual int MaxRetryTimeMillis() const = 0; | 120 virtual int MaxRetryTimeMillis() const = 0; |
119 virtual base::HistogramBase* GetRetryTimeHistogram(MethodID method) const = 0; | 121 virtual base::HistogramBase* GetRetryTimeHistogram(MethodID method) const = 0; |
120 virtual base::HistogramBase* GetRecoveredFromErrorHistogram( | 122 virtual base::HistogramBase* GetRecoveredFromErrorHistogram( |
121 MethodID method) const = 0; | 123 MethodID method) const = 0; |
122 }; | 124 }; |
123 | 125 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 leveldb::WritableFile** result); | 161 leveldb::WritableFile** result); |
160 virtual leveldb::Status NewLogger(const std::string& fname, | 162 virtual leveldb::Status NewLogger(const std::string& fname, |
161 leveldb::Logger** result); | 163 leveldb::Logger** result); |
162 | 164 |
163 protected: | 165 protected: |
164 explicit ChromiumEnv(const std::string& name); | 166 explicit ChromiumEnv(const std::string& name); |
165 | 167 |
166 static const char* FileErrorString(base::File::Error error); | 168 static const char* FileErrorString(base::File::Error error); |
167 | 169 |
168 private: | 170 private: |
169 virtual void RecordErrorAt(MethodID method) const; | 171 void RecordErrorAt(MethodID method) const override; |
170 virtual void RecordOSError(MethodID method, | 172 void RecordOSError(MethodID method, base::File::Error error) const override; |
171 base::File::Error error) const; | 173 void RecordBytesRead(int amount) const override; |
| 174 void RecordBytesWritten(int amount) const override; |
172 void RecordOpenFilesLimit(const std::string& type); | 175 void RecordOpenFilesLimit(const std::string& type); |
173 base::HistogramBase* GetMaxFDHistogram(const std::string& type) const; | 176 base::HistogramBase* GetMaxFDHistogram(const std::string& type) const; |
174 base::HistogramBase* GetOSErrorHistogram(MethodID method, int limit) const; | 177 base::HistogramBase* GetOSErrorHistogram(MethodID method, int limit) const; |
175 void DeleteBackupFiles(const base::FilePath& dir); | 178 void DeleteBackupFiles(const base::FilePath& dir); |
176 | 179 |
177 // File locks may not be exclusive within a process (e.g. on POSIX). Track | 180 // File locks may not be exclusive within a process (e.g. on POSIX). Track |
178 // locks held by the ChromiumEnv to prevent access within the process. | 181 // locks held by the ChromiumEnv to prevent access within the process. |
179 class LockTable { | 182 class LockTable { |
180 public: | 183 public: |
181 bool Insert(const std::string& fname) { | 184 bool Insert(const std::string& fname) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void (*function)(void*); | 226 void (*function)(void*); |
224 }; | 227 }; |
225 typedef std::deque<BGItem> BGQueue; | 228 typedef std::deque<BGItem> BGQueue; |
226 BGQueue queue_; | 229 BGQueue queue_; |
227 LockTable locks_; | 230 LockTable locks_; |
228 }; | 231 }; |
229 | 232 |
230 } // namespace leveldb_env | 233 } // namespace leveldb_env |
231 | 234 |
232 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 235 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
OLD | NEW |