Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1287)

Unified Diff: chrome/browser/extensions/settings/settings_leveldb_storage.cc

Issue 10035042: Rewrite base::JSONReader to be 35-40% faster, depending on the input string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix Windows, address comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/settings/settings_leveldb_storage.cc
diff --git a/chrome/browser/extensions/settings/settings_leveldb_storage.cc b/chrome/browser/extensions/settings/settings_leveldb_storage.cc
index e8f8e9226a0017433c7a46b6315b3f3eb065c197..8dc3c8ae29c455b80774f1c16b6bbec7913285cb 100644
--- a/chrome/browser/extensions/settings/settings_leveldb_storage.cc
+++ b/chrome/browser/extensions/settings/settings_leveldb_storage.cc
@@ -164,8 +164,7 @@ SettingsStorage::ReadResult SettingsLeveldbStorage::Get() {
options.snapshot = snapshot.get();
scoped_ptr<leveldb::Iterator> it(db_->NewIterator(options));
for (it->SeekToFirst(); it->Valid(); it->Next()) {
- Value* value =
- json_reader.JsonToValue(it->value().ToString(), false, false);
+ Value* value = json_reader.ReadToValue(it->value().ToString());
if (value != NULL) {
settings->SetWithoutPathExpansion(it->key().ToString(), value);
} else {
@@ -276,8 +275,7 @@ SettingsStorage::WriteResult SettingsLeveldbStorage::Clear() {
for (it->SeekToFirst(); it->Valid(); it->Next()) {
const std::string key = it->key().ToString();
const std::string old_value_json = it->value().ToString();
- Value* old_value =
- base::JSONReader().JsonToValue(old_value_json, false, false);
+ Value* old_value = base::JSONReader().ReadToValue(old_value_json);
if (old_value) {
changes->push_back(SettingChange(key, old_value, NULL));
} else {
@@ -319,7 +317,7 @@ bool SettingsLeveldbStorage::ReadFromDb(
return false;
}
- Value* value = base::JSONReader().JsonToValue(value_as_json, false, false);
+ Value* value = base::JSONReader().ReadToValue(value_as_json);
if (value == NULL) {
// TODO(kalman): clear the offending non-JSON value from the database.
LOG(ERROR) << "Invalid JSON in database: " << value_as_json;
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/prefs/pref_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698