| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Clears the in-memory cache if currently no changes are pending. If there | 77 // Clears the in-memory cache if currently no changes are pending. If there |
| 78 // are uncommitted changes this method does nothing. | 78 // are uncommitted changes this method does nothing. |
| 79 void PurgeMemory(); | 79 void PurgeMemory(); |
| 80 | 80 |
| 81 // LevelDBWrapper: | 81 // LevelDBWrapper: |
| 82 void AddObserver(mojom::LevelDBObserverAssociatedPtrInfo observer) override; | 82 void AddObserver(mojom::LevelDBObserverAssociatedPtrInfo observer) override; |
| 83 void Put(const std::vector<uint8_t>& key, | 83 void Put(const std::vector<uint8_t>& key, |
| 84 const std::vector<uint8_t>& value, | 84 const std::vector<uint8_t>& value, |
| 85 const std::string& source, | 85 const std::string& source, |
| 86 const PutCallback& callback) override; | 86 PutCallback callback) override; |
| 87 void Delete(const std::vector<uint8_t>& key, | 87 void Delete(const std::vector<uint8_t>& key, |
| 88 const std::string& source, | 88 const std::string& source, |
| 89 const DeleteCallback& callback) override; | 89 DeleteCallback callback) override; |
| 90 void DeleteAll(const std::string& source, | 90 void DeleteAll(const std::string& source, |
| 91 const DeleteAllCallback& callback) override; | 91 DeleteAllCallback callback) override; |
| 92 void Get(const std::vector<uint8_t>& key, | 92 void Get(const std::vector<uint8_t>& key, GetCallback callback) override; |
| 93 const GetCallback& callback) override; | |
| 94 void GetAll( | 93 void GetAll( |
| 95 mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback, | 94 mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback, |
| 96 const GetAllCallback& callback) override; | 95 GetAllCallback callback) override; |
| 97 | 96 |
| 98 private: | 97 private: |
| 99 // Used to rate limit commits. | 98 // Used to rate limit commits. |
| 100 class RateLimiter { | 99 class RateLimiter { |
| 101 public: | 100 public: |
| 102 RateLimiter(size_t desired_rate, base::TimeDelta time_quantum); | 101 RateLimiter(size_t desired_rate, base::TimeDelta time_quantum); |
| 103 | 102 |
| 104 void add_samples(size_t samples) { samples_ += samples; } | 103 void add_samples(size_t samples) { samples_ += samples; } |
| 105 | 104 |
| 106 // Computes the total time needed to process the total samples seen | 105 // Computes the total time needed to process the total samples seen |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; | 156 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; |
| 158 | 157 |
| 159 static bool s_aggressive_flushing_enabled_; | 158 static bool s_aggressive_flushing_enabled_; |
| 160 | 159 |
| 161 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); | 160 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); |
| 162 }; | 161 }; |
| 163 | 162 |
| 164 } // namespace content | 163 } // namespace content |
| 165 | 164 |
| 166 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ | 165 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ |
| OLD | NEW |