| 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 EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ |
| 6 #define EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 static bool CreateKey(const std::string& scope, | 39 static bool CreateKey(const std::string& scope, |
| 40 const std::string& key, | 40 const std::string& key, |
| 41 std::string* scoped_key); | 41 std::string* scoped_key); |
| 42 | 42 |
| 43 LeveldbScopedDatabase(const std::string& uma_client_name, | 43 LeveldbScopedDatabase(const std::string& uma_client_name, |
| 44 const base::FilePath& path); | 44 const base::FilePath& path); |
| 45 | 45 |
| 46 // Reads a single |value| from the database for the specified |key|. | 46 // Reads a single |value| from the database for the specified |key|. |
| 47 ValueStore::Status Read(const std::string& scope, | 47 ValueStore::Status Read(const std::string& scope, |
| 48 const std::string& key, | 48 const std::string& key, |
| 49 scoped_ptr<base::Value>* value); | 49 std::unique_ptr<base::Value>* value); |
| 50 | 50 |
| 51 // Reads all |values| from the database stored within the specified |scope|. | 51 // Reads all |values| from the database stored within the specified |scope|. |
| 52 ValueStore::Status Read(const std::string& scope, | 52 ValueStore::Status Read(const std::string& scope, |
| 53 base::DictionaryValue* values); | 53 base::DictionaryValue* values); |
| 54 | 54 |
| 55 // Writes a single |key| => |value| to the database. | 55 // Writes a single |key| => |value| to the database. |
| 56 ValueStore::Status Write(const std::string& scope, | 56 ValueStore::Status Write(const std::string& scope, |
| 57 const std::string& key, | 57 const std::string& key, |
| 58 const base::Value& value); | 58 const base::Value& value); |
| 59 | 59 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 72 static ValueStore::Status AddToWriteBatch(leveldb::WriteBatch* batch, | 72 static ValueStore::Status AddToWriteBatch(leveldb::WriteBatch* batch, |
| 73 const std::string& scope, | 73 const std::string& scope, |
| 74 const std::string& key, | 74 const std::string& key, |
| 75 const base::Value& value); | 75 const base::Value& value); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(LeveldbScopedDatabase); | 78 DISALLOW_COPY_AND_ASSIGN(LeveldbScopedDatabase); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ | 81 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_ |
| OLD | NEW |