| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // rescheduled and will be flushed at the scheduled time after which | 67 // rescheduled and will be flushed at the scheduled time after which |
| 68 // aggressive flushing will commence. | 68 // aggressive flushing will commence. |
| 69 static void EnableAggressiveCommitDelay(); | 69 static void EnableAggressiveCommitDelay(); |
| 70 | 70 |
| 71 // Commits any uncommitted data to the database as soon as possible. This | 71 // Commits any uncommitted data to the database as soon as possible. This |
| 72 // usually means data will be committed immediately, but if we're currently | 72 // usually means data will be committed immediately, but if we're currently |
| 73 // waiting on the result of initializing our map the commit won't happen | 73 // waiting on the result of initializing our map the commit won't happen |
| 74 // until the load has finished. | 74 // until the load has finished. |
| 75 void ScheduleImmediateCommit(); | 75 void ScheduleImmediateCommit(); |
| 76 | 76 |
| 77 // Clears the in-memory cache if currently no changes are pending. If there |
| 78 // are uncommitted changes this method does nothing. |
| 79 void PurgeMemory(); |
| 80 |
| 77 // LevelDBWrapper: | 81 // LevelDBWrapper: |
| 78 void AddObserver(mojom::LevelDBObserverAssociatedPtrInfo observer) override; | 82 void AddObserver(mojom::LevelDBObserverAssociatedPtrInfo observer) override; |
| 79 void Put(const std::vector<uint8_t>& key, | 83 void Put(const std::vector<uint8_t>& key, |
| 80 const std::vector<uint8_t>& value, | 84 const std::vector<uint8_t>& value, |
| 81 const std::string& source, | 85 const std::string& source, |
| 82 const PutCallback& callback) override; | 86 const PutCallback& callback) override; |
| 83 void Delete(const std::vector<uint8_t>& key, | 87 void Delete(const std::vector<uint8_t>& key, |
| 84 const std::string& source, | 88 const std::string& source, |
| 85 const DeleteCallback& callback) override; | 89 const DeleteCallback& callback) override; |
| 86 void DeleteAll(const std::string& source, | 90 void DeleteAll(const std::string& source, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; | 157 base::WeakPtrFactory<LevelDBWrapperImpl> weak_ptr_factory_; |
| 154 | 158 |
| 155 static bool s_aggressive_flushing_enabled_; | 159 static bool s_aggressive_flushing_enabled_; |
| 156 | 160 |
| 157 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); | 161 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); |
| 158 }; | 162 }; |
| 159 | 163 |
| 160 } // namespace content | 164 } // namespace content |
| 161 | 165 |
| 162 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ | 166 #endif // CONTENT_BROWSER_LEVELDB_WRAPPER_IMPL_H_ |
| OLD | NEW |