Skip to content

Commit

Permalink
Refactor components/cronet to use PrefService::GetValue*
Browse files Browse the repository at this point in the history
This is part of a larger migration effort based on
go/trust-your-prefs.

Bug: 1342019, 1341998, 1341996
Test: Existing unit tests
Change-Id: I369b140d903d33d566d853b4369d32a6aec91d24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3810279
Commit-Queue: Roland Bock <rbock@google.com>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032439}
  • Loading branch information
Roland Bock authored and Chromium LUCI CQ committed Aug 8, 2022
1 parent 7dee280 commit f3a9a13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions components/cronet/cronet_prefs_manager.cc
Expand Up @@ -116,7 +116,7 @@ class PrefServiceAdapter : public net::HttpServerProperties::PrefDelegate {

// PrefDelegate implementation.
const base::Value* GetServerProperties() const override {
return pref_service_->Get(path_);
return &pref_service_->GetValue(path_);
}

void SetServerProperties(const base::Value& value,
Expand Down Expand Up @@ -183,9 +183,7 @@ class NetworkQualitiesPrefDelegateImpl
base::Value::Dict GetDictionaryValue() override {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
UMA_HISTOGRAM_EXACT_LINEAR("NQE.Prefs.ReadCount", 1, 2);
return pref_service_->GetDictionary(kNetworkQualitiesPref)
->GetDict()
.Clone();
return pref_service_->GetValueDict(kNetworkQualitiesPref).Clone();
}

private:
Expand Down
3 changes: 1 addition & 2 deletions components/cronet/host_cache_persistence_manager.cc
Expand Up @@ -56,8 +56,7 @@ void HostCachePersistenceManager::ReadFromDisk() {
return;

net_log_.BeginEvent(net::NetLogEventType::HOST_CACHE_PREF_READ);
const base::Value::List& pref_value =
pref_service_->GetList(pref_name_)->GetList();
const base::Value::List& pref_value = pref_service_->GetValueList(pref_name_);
bool success = cache_->RestoreFromListValue(pref_value);
net_log_.AddEntryWithBoolParams(net::NetLogEventType::HOST_CACHE_PREF_READ,
net::NetLogEventPhase::END, "success",
Expand Down

0 comments on commit f3a9a13

Please sign in to comment.