| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium 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. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ | 6 #define CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void Delete(const std::vector<uint8_t>& key, | 73 void Delete(const std::vector<uint8_t>& key, |
| 74 const std::string& source, | 74 const std::string& source, |
| 75 const DeleteCallback& callback) override; | 75 const DeleteCallback& callback) override; |
| 76 void DeleteAll(const std::string& source, | 76 void DeleteAll(const std::string& source, |
| 77 const DeleteAllCallback& callback) override; | 77 const DeleteAllCallback& callback) override; |
| 78 void Get(const std::vector<uint8_t>& key, | 78 void Get(const std::vector<uint8_t>& key, |
| 79 const GetCallback& callback) override; | 79 const GetCallback& callback) override; |
| 80 void GetAll( | 80 void GetAll( |
| 81 mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback, | 81 mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback, |
| 82 const GetAllCallback& callback) override; | 82 const GetAllCallback& callback) override; |
| 83 void FlushPipe(const FlushPipeCallback& callback) override; |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 using ValueMap = std::map<std::vector<uint8_t>, std::vector<uint8_t>>; | 86 using ValueMap = std::map<std::vector<uint8_t>, std::vector<uint8_t>>; |
| 86 | 87 |
| 87 // Used to rate limit commits. | 88 // Used to rate limit commits. |
| 88 class RateLimiter { | 89 class RateLimiter { |
| 89 public: | 90 public: |
| 90 RateLimiter(size_t desired_rate, base::TimeDelta time_quantum); | 91 RateLimiter(size_t desired_rate, base::TimeDelta time_quantum); |
| 91 | 92 |
| 92 void add_samples(size_t samples) { samples_ += samples; } | 93 void add_samples(size_t samples) { samples_ += samples; } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; | 145 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; |
| 145 | 146 |
| 146 static bool s_aggressive_flushing_enabled_; | 147 static bool s_aggressive_flushing_enabled_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); | 149 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace content | 152 } // namespace content |
| 152 | 153 |
| 153 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ | 154 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ |
| OLD | NEW |