Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "third_party/leveldatabase/src/include/leveldb/slice.h" | 13 #include "third_party/leveldatabase/src/include/leveldb/slice.h" |
| 14 #include "third_party/leveldatabase/src/include/leveldb/status.h" | |
|
nhiroki
2014/08/01 09:43:38
Forward decl seems to work well.
peria
2014/08/04 03:13:43
Done.
| |
| 14 | 15 |
| 15 namespace leveldb { | 16 namespace leveldb { |
| 16 class DB; | 17 class DB; |
| 17 class Iterator; | 18 class Iterator; |
| 18 class Slice; | 19 class Slice; |
| 19 class Status; | |
| 20 class WriteBatch; | 20 class WriteBatch; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace sync_file_system { | 23 namespace sync_file_system { |
| 24 namespace drive_backend { | 24 namespace drive_backend { |
| 25 | 25 |
| 26 class SliceComparator { | 26 class SliceComparator { |
| 27 public: | 27 public: |
| 28 bool operator()(const leveldb::Slice& a, const leveldb::Slice& b) const { | 28 bool operator()(const leveldb::Slice& a, const leveldb::Slice& b) const { |
| 29 return a.compare(b) < 0; | 29 return a.compare(b) < 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 leveldb::Status Get(const std::string& key, std::string* value); | 81 leveldb::Status Get(const std::string& key, std::string* value); |
| 82 scoped_ptr<Iterator> NewIterator(); | 82 scoped_ptr<Iterator> NewIterator(); |
| 83 | 83 |
| 84 // Commits pending transactions to |db_| and clears cached transactions. | 84 // Commits pending transactions to |db_| and clears cached transactions. |
| 85 // Returns true if the commitment succeeds. | 85 // Returns true if the commitment succeeds. |
| 86 leveldb::Status Commit(); | 86 leveldb::Status Commit(); |
| 87 | 87 |
| 88 // Clears pending transactions. | 88 // Clears pending transactions. |
| 89 void Clear(); | 89 void Clear(); |
| 90 | 90 |
| 91 leveldb::DB* GetLevelDBForTesting(); | 91 // TODO(peria): Rename this method to GetLevelDBForTesting, after removing |
| 92 // usages of driva_backend::MigrateDatabaseFromVxToVy() under | |
| 93 // drive_backend_v1/. | |
| 94 leveldb::DB* GetLevelDB(); | |
| 92 | 95 |
| 93 private: | 96 private: |
| 94 scoped_ptr<leveldb::DB> db_; | 97 scoped_ptr<leveldb::DB> db_; |
| 95 | 98 |
| 96 PendingOperationMap pending_; | 99 PendingOperationMap pending_; |
| 97 | 100 |
| 98 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); | 101 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace drive_backend | 104 } // namespace drive_backend |
| 102 } // namespace sync_file_system | 105 } // namespace sync_file_system |
| 103 | 106 |
| 104 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 107 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
| OLD | NEW |