| 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 "extensions/browser/value_store/leveldb_value_store.h" | 5 #include "extensions/browser/value_store/leveldb_value_store.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return MakeReadResult(status); | 81 return MakeReadResult(status); |
| 82 | 82 |
| 83 std::unique_ptr<base::DictionaryValue> settings(new base::DictionaryValue()); | 83 std::unique_ptr<base::DictionaryValue> settings(new base::DictionaryValue()); |
| 84 | 84 |
| 85 for (const std::string& key : keys) { | 85 for (const std::string& key : keys) { |
| 86 std::unique_ptr<base::Value> setting; | 86 std::unique_ptr<base::Value> setting; |
| 87 status.Merge(Read(key, &setting)); | 87 status.Merge(Read(key, &setting)); |
| 88 if (!status.ok()) | 88 if (!status.ok()) |
| 89 return MakeReadResult(status); | 89 return MakeReadResult(status); |
| 90 if (setting) | 90 if (setting) |
| 91 settings->SetWithoutPathExpansion(key, setting.release()); | 91 settings->SetWithoutPathExpansion(key, std::move(setting)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 return MakeReadResult(std::move(settings), status); | 94 return MakeReadResult(std::move(settings), status); |
| 95 } | 95 } |
| 96 | 96 |
| 97 ValueStore::ReadResult LeveldbValueStore::Get() { | 97 ValueStore::ReadResult LeveldbValueStore::Get() { |
| 98 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 98 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 99 | 99 |
| 100 Status status = EnsureDbIsOpen(); | 100 Status status = EnsureDbIsOpen(); |
| 101 if (!status.ok()) | 101 if (!status.ok()) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 return Status(OTHER_ERROR, kCannotSerialize); | 295 return Status(OTHER_ERROR, kCannotSerialize); |
| 296 batch->Put(key, value_as_json); | 296 batch->Put(key, value_as_json); |
| 297 } | 297 } |
| 298 | 298 |
| 299 return Status(); | 299 return Status(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 ValueStore::Status LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) { | 302 ValueStore::Status LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) { |
| 303 return ToValueStoreError(db()->Write(write_options(), batch)); | 303 return ToValueStoreError(db()->Write(write_options(), batch)); |
| 304 } | 304 } |
| OLD | NEW |