| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 13 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
| 13 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" | 14 #include "third_party/leveldatabase/src/include/leveldb/iterator.h" |
| 14 #include "third_party/leveldatabase/src/include/leveldb/slice.h" | 15 #include "third_party/leveldatabase/src/include/leveldb/slice.h" |
| 15 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 16 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
| 16 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" | 17 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" |
| 17 | 18 |
| 18 namespace sync_file_system { | 19 namespace sync_file_system { |
| 19 namespace drive_backend { | 20 namespace drive_backend { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 138 |
| 138 while (map_iterator_ != db_->pending_.end() && | 139 while (map_iterator_ != db_->pending_.end() && |
| 139 map_iterator_->second.first == DELETE_OPERATION) | 140 map_iterator_->second.first == DELETE_OPERATION) |
| 140 ++map_iterator_; | 141 ++map_iterator_; |
| 141 } | 142 } |
| 142 | 143 |
| 143 // --------------------------------------------------------------------------- | 144 // --------------------------------------------------------------------------- |
| 144 // LevelDBWrapper class | 145 // LevelDBWrapper class |
| 145 // --------------------------------------------------------------------------- | 146 // --------------------------------------------------------------------------- |
| 146 LevelDBWrapper::LevelDBWrapper(scoped_ptr<leveldb::DB> db) | 147 LevelDBWrapper::LevelDBWrapper(scoped_ptr<leveldb::DB> db) |
| 147 : db_(db.Pass()), num_puts_(0), num_deletes_(0) { | 148 : db_(std::move(db)), num_puts_(0), num_deletes_(0) { |
| 148 DCHECK(db_); | 149 DCHECK(db_); |
| 149 } | 150 } |
| 150 | 151 |
| 151 LevelDBWrapper::~LevelDBWrapper() {} | 152 LevelDBWrapper::~LevelDBWrapper() {} |
| 152 | 153 |
| 153 void LevelDBWrapper::Put(const std::string& key, const std::string& value) { | 154 void LevelDBWrapper::Put(const std::string& key, const std::string& value) { |
| 154 pending_[key] = Transaction(PUT_OPERATION, value); | 155 pending_[key] = Transaction(PUT_OPERATION, value); |
| 155 ++num_puts_; | 156 ++num_puts_; |
| 156 } | 157 } |
| 157 | 158 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 num_puts_ = 0; | 212 num_puts_ = 0; |
| 212 num_deletes_ = 0; | 213 num_deletes_ = 0; |
| 213 } | 214 } |
| 214 | 215 |
| 215 leveldb::DB* LevelDBWrapper::GetLevelDB() { | 216 leveldb::DB* LevelDBWrapper::GetLevelDB() { |
| 216 return db_.get(); | 217 return db_.get(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 } // namespace drive_backend | 220 } // namespace drive_backend |
| 220 } // namespace sync_file_system | 221 } // namespace sync_file_system |
| OLD | NEW |