[CodeHealthRotation] Value(DICTIONARY) to Value::Dict for //net
Changes function bodies; base::Value remains the return type for logging Bug: 1303949, 1345441 Change-Id: I2d98c6c78bcd8bb1c370bc5f7cf21b0821fac065 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3770726 Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Travis Skare <skare@chromium.org> Cr-Commit-Position: refs/heads/main@{#1028781}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f2a7c4c832
commit
adae7ff838
net
cert
cert_verify_proc_builtin.ccct_signed_certificate_timestamp_log_param.cctrial_comparison_cert_verifier.cc
disk_cache
docs
http
log
nqe
proxy_resolution
url_request
url_request.ccurl_request_http_job.ccurl_request_job.ccurl_request_netlog_params.ccurl_request_throttler_entry.cc
websockets
@ -58,19 +58,19 @@ const void* kResultDebugDataKey = &kResultDebugDataKey;
|
||||
|
||||
base::Value NetLogCertParams(const CRYPTO_BUFFER* cert_handle,
|
||||
const CertErrors& errors) {
|
||||
base::Value results(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict results;
|
||||
|
||||
std::string pem_encoded;
|
||||
if (X509Certificate::GetPEMEncodedFromDER(
|
||||
x509_util::CryptoBufferAsStringPiece(cert_handle), &pem_encoded)) {
|
||||
results.GetDict().Set("certificate", pem_encoded);
|
||||
results.Set("certificate", pem_encoded);
|
||||
}
|
||||
|
||||
std::string errors_string = errors.ToDebugString();
|
||||
if (!errors_string.empty())
|
||||
results.GetDict().Set("errors", errors_string);
|
||||
results.Set("errors", errors_string);
|
||||
|
||||
return results;
|
||||
return base::Value(std::move(results));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED)
|
||||
@ -833,12 +833,12 @@ int CertVerifyProcBuiltin::VerifyInternal(
|
||||
verification_type = cur_attempt.verification_type;
|
||||
net_log.BeginEvent(
|
||||
NetLogEventType::CERT_VERIFY_PROC_PATH_BUILD_ATTEMPT, [&] {
|
||||
base::Value results(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict results;
|
||||
if (verification_type == VerificationType::kEV)
|
||||
results.GetDict().Set("is_ev_attempt", true);
|
||||
results.GetDict().Set("digest_policy",
|
||||
static_cast<int>(cur_attempt.digest_policy));
|
||||
return results;
|
||||
results.Set("is_ev_attempt", true);
|
||||
results.Set("digest_policy",
|
||||
static_cast<int>(cur_attempt.digest_policy));
|
||||
return base::Value(std::move(results));
|
||||
});
|
||||
|
||||
// If a previous attempt used up most/all of the deadline, extend the
|
||||
|
@ -73,11 +73,11 @@ base::Value SCTListToPrintableValues(
|
||||
|
||||
base::Value NetLogSignedCertificateTimestampParams(
|
||||
const SignedCertificateTimestampAndStatusList* scts) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
|
||||
dict.GetDict().Set("scts", SCTListToPrintableValues(*scts));
|
||||
dict.Set("scts", SCTListToPrintableValues(*scts));
|
||||
|
||||
return dict;
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogRawSignedCertificateTimestampParams(
|
||||
|
@ -30,9 +30,9 @@ namespace net {
|
||||
namespace {
|
||||
|
||||
base::Value JobResultParams(bool trial_success) {
|
||||
base::Value results(base::Value::Type::DICTIONARY);
|
||||
results.GetDict().Set("trial_success", trial_success);
|
||||
return results;
|
||||
base::Value::Dict results;
|
||||
results.Set("trial_success", trial_success);
|
||||
return base::Value(std::move(results));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -58,7 +58,7 @@ std::string GenerateChildName(const std::string& base_name, int64_t child_id) {
|
||||
// Returns NetLog parameters for the creation of a MemEntryImpl. A separate
|
||||
// function is needed because child entries don't store their key().
|
||||
base::Value NetLogEntryCreationParams(const MemEntryImpl* entry) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
std::string key;
|
||||
switch (entry->type()) {
|
||||
case MemEntryImpl::EntryType::kParent:
|
||||
@ -68,9 +68,9 @@ base::Value NetLogEntryCreationParams(const MemEntryImpl* entry) {
|
||||
key = GenerateChildName(entry->parent()->key(), entry->child_id());
|
||||
break;
|
||||
}
|
||||
dict.SetStringKey("key", key);
|
||||
dict.SetBoolKey("created", true);
|
||||
return dict;
|
||||
dict.Set("key", key);
|
||||
dict.Set("created", true);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -19,39 +19,39 @@ base::Value NetLogReadWriteDataParams(int index,
|
||||
int offset,
|
||||
int buf_len,
|
||||
bool truncate) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetIntKey("index", index);
|
||||
dict.SetIntKey("offset", offset);
|
||||
dict.SetIntKey("buf_len", buf_len);
|
||||
base::Value::Dict dict;
|
||||
dict.Set("index", index);
|
||||
dict.Set("offset", offset);
|
||||
dict.Set("buf_len", buf_len);
|
||||
if (truncate)
|
||||
dict.SetBoolKey("truncate", truncate);
|
||||
return dict;
|
||||
dict.Set("truncate", truncate);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogReadWriteCompleteParams(int bytes_copied) {
|
||||
DCHECK_NE(bytes_copied, net::ERR_IO_PENDING);
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
if (bytes_copied < 0) {
|
||||
dict.SetIntKey("net_error", bytes_copied);
|
||||
dict.Set("net_error", bytes_copied);
|
||||
} else {
|
||||
dict.SetIntKey("bytes_copied", bytes_copied);
|
||||
dict.Set("bytes_copied", bytes_copied);
|
||||
}
|
||||
return dict;
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogSparseOperationParams(int64_t offset, int buf_len) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetKey("offset", net::NetLogNumberValue(offset));
|
||||
dict.SetIntKey("buf_len", buf_len);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("offset", net::NetLogNumberValue(offset));
|
||||
dict.Set("buf_len", buf_len);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogSparseReadWriteParams(const net::NetLogSource& source,
|
||||
int child_len) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
source.AddToEventParameters(&dict);
|
||||
dict.SetIntKey("child_len", child_len);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
source.AddToEventParameters(dict);
|
||||
dict.Set("child_len", child_len);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -61,10 +61,10 @@ namespace disk_cache {
|
||||
base::Value CreateNetLogParametersEntryCreationParams(const Entry* entry,
|
||||
bool created) {
|
||||
DCHECK(entry);
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("key", entry->GetKey());
|
||||
dict.SetBoolKey("created", created);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("key", entry->GetKey());
|
||||
dict.Set("created", created);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
void NetLogReadWriteData(const net::NetLogWithSource& net_log,
|
||||
@ -109,14 +109,14 @@ void NetLogSparseReadWrite(const net::NetLogWithSource& net_log,
|
||||
|
||||
base::Value CreateNetLogGetAvailableRangeResultParams(
|
||||
disk_cache::RangeResult result) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
if (result.net_error == net::OK) {
|
||||
dict.SetIntKey("length", result.available_len);
|
||||
dict.SetKey("start", net::NetLogNumberValue(result.start));
|
||||
dict.Set("length", result.available_len);
|
||||
dict.Set("start", net::NetLogNumberValue(result.start));
|
||||
} else {
|
||||
dict.SetIntKey("net_error", result.net_error);
|
||||
dict.Set("net_error", result.net_error);
|
||||
}
|
||||
return dict;
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace disk_cache
|
||||
|
@ -20,20 +20,20 @@ namespace {
|
||||
|
||||
base::Value NetLogSimpleEntryConstructionParams(
|
||||
const disk_cache::SimpleEntryImpl* entry) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("entry_hash",
|
||||
base::StringPrintf("%#016" PRIx64, entry->entry_hash()));
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("entry_hash",
|
||||
base::StringPrintf("%#016" PRIx64, entry->entry_hash()));
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogSimpleEntryCreationParams(
|
||||
const disk_cache::SimpleEntryImpl* entry,
|
||||
int net_error) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetIntKey("net_error", net_error);
|
||||
base::Value::Dict dict;
|
||||
dict.Set("net_error", net_error);
|
||||
if (net_error == net::OK)
|
||||
dict.SetStringKey("key", entry->key());
|
||||
return dict;
|
||||
dict.Set("key", entry->key());
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -123,14 +123,14 @@ at all capture modes.
|
||||
|
||||
```
|
||||
net_log.AddEvent(NetLogEventType::SSL_CERTIFICATES_RECEIVED, [&] {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
base::Value certs(base::Value::Type::LIST);
|
||||
std::vector<std::string> encoded_chain;
|
||||
server_cert_->GetPEMEncodedChain(&encoded_chain);
|
||||
for (auto& pem : encoded_chain)
|
||||
certs.Append(std::move(pem));
|
||||
dict.SetKey("certificates", std::move(certs));
|
||||
return dict;
|
||||
dict.Set("certificates", std::move(certs));
|
||||
return base::Value(std::move(dict));
|
||||
});
|
||||
```
|
||||
|
||||
@ -156,10 +156,10 @@ net_log.AddEvent(NetLogEventType::COOKIE_STORE_COOKIE_ADDED,
|
||||
[&](NetLogCaptureMode capture_mode) {
|
||||
if (!NetLogCaptureIncludesSensitive(capture_mode))
|
||||
return base::Value();
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("name", cookie->Name());
|
||||
dict.SetStringKey("value", cookie->Value());
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("name", cookie->Name());
|
||||
dict.Set("value", cookie->Value());
|
||||
return base::Value(std::move(dict));
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -709,9 +709,7 @@ void HttpServerPropertiesManager::WriteToPrefs(
|
||||
std::set<std::pair<std::string, NetworkIsolationKey>>
|
||||
persisted_canonical_suffix_set;
|
||||
const base::Time now = base::Time::Now();
|
||||
base::Value http_server_properties_value(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict& http_server_properties_dict =
|
||||
http_server_properties_value.GetDict();
|
||||
base::Value::Dict http_server_properties_dict;
|
||||
|
||||
// Convert |server_info_map| to a list Value and add it to
|
||||
// |http_server_properties_dict|.
|
||||
@ -768,11 +766,12 @@ void HttpServerPropertiesManager::WriteToPrefs(
|
||||
broken_alternative_service_list, kMaxBrokenAlternativeServicesToPersist,
|
||||
recently_broken_alternative_services, http_server_properties_dict);
|
||||
|
||||
pref_delegate_->SetServerProperties(http_server_properties_value,
|
||||
std::move(callback));
|
||||
pref_delegate_->SetServerProperties(
|
||||
base::Value(http_server_properties_dict.Clone()), std::move(callback));
|
||||
|
||||
net_log_.AddEvent(NetLogEventType::HTTP_SERVER_PROPERTIES_UPDATE_PREFS,
|
||||
[&] { return http_server_properties_value.Clone(); });
|
||||
net_log_.AddEvent(NetLogEventType::HTTP_SERVER_PROPERTIES_UPDATE_PREFS, [&] {
|
||||
return base::Value(std::move(http_server_properties_dict));
|
||||
});
|
||||
}
|
||||
|
||||
void HttpServerPropertiesManager::SaveAlternativeServiceToServerPrefs(
|
||||
|
@ -56,11 +56,6 @@ void NetLogSource::AddToEventParameters(base::Value::Dict& event_params) const {
|
||||
event_params.Set("source_dependency", std::move(dict));
|
||||
}
|
||||
|
||||
void NetLogSource::AddToEventParameters(base::Value* event_params) const {
|
||||
DCHECK(event_params->is_dict());
|
||||
AddToEventParameters(event_params->GetDict());
|
||||
}
|
||||
|
||||
base::Value NetLogSource::ToEventParameters() const {
|
||||
return SourceEventParametersCallback(*this);
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ struct NET_EXPORT NetLogSource {
|
||||
// Adds the source to a dictionary containing event parameters,
|
||||
// using the name "source_dependency".
|
||||
void AddToEventParameters(base::Value::Dict& event_params) const;
|
||||
// Legacy version of above method. Should be removed once no longer used.
|
||||
void AddToEventParameters(base::Value* event_params) const;
|
||||
|
||||
// Returns a dictionary with a single entry named "source_dependency" that
|
||||
// describes |this|.
|
||||
|
@ -24,15 +24,14 @@ base::Value NetworkQualityChangedNetLogParams(
|
||||
base::TimeDelta transport_rtt,
|
||||
int32_t downstream_throughput_kbps,
|
||||
EffectiveConnectionType effective_connection_type) {
|
||||
base::Value value(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict& dict = value.GetDict();
|
||||
dict.Set("http_rtt_ms", static_cast<int>(http_rtt.InMilliseconds()));
|
||||
dict.Set("transport_rtt_ms",
|
||||
static_cast<int>(transport_rtt.InMilliseconds()));
|
||||
dict.Set("downstream_throughput_kbps", downstream_throughput_kbps);
|
||||
dict.Set("effective_connection_type",
|
||||
GetNameForEffectiveConnectionType(effective_connection_type));
|
||||
return value;
|
||||
base::Value::Dict value;
|
||||
value.Set("http_rtt_ms", static_cast<int>(http_rtt.InMilliseconds()));
|
||||
value.Set("transport_rtt_ms",
|
||||
static_cast<int>(transport_rtt.InMilliseconds()));
|
||||
value.Set("downstream_throughput_kbps", downstream_throughput_kbps);
|
||||
value.Set("effective_connection_type",
|
||||
GetNameForEffectiveConnectionType(effective_connection_type));
|
||||
return base::Value(std::move(value));
|
||||
}
|
||||
|
||||
bool MetricChangedMeaningfully(int32_t past_value, int32_t current_value) {
|
||||
|
@ -292,30 +292,30 @@ class ProxyResolverFactoryForPacResult : public ProxyResolverFactory {
|
||||
base::Value NetLogProxyConfigChangedParams(
|
||||
const absl::optional<ProxyConfigWithAnnotation>* old_config,
|
||||
const ProxyConfigWithAnnotation* new_config) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
// The "old_config" is optional -- the first notification will not have
|
||||
// any "previous" configuration.
|
||||
if (old_config->has_value())
|
||||
dict.SetKey("old_config", (*old_config)->value().ToValue());
|
||||
dict.SetKey("new_config", new_config->value().ToValue());
|
||||
return dict;
|
||||
dict.Set("old_config", (*old_config)->value().ToValue());
|
||||
dict.Set("new_config", new_config->value().ToValue());
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogBadProxyListParams(const ProxyRetryInfoMap* retry_info) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
base::Value list(base::Value::Type::LIST);
|
||||
|
||||
for (const auto& retry_info_pair : *retry_info)
|
||||
list.Append(retry_info_pair.first);
|
||||
dict.SetKey("bad_proxy_list", std::move(list));
|
||||
return dict;
|
||||
dict.Set("bad_proxy_list", std::move(list));
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
// Returns NetLog parameters on a successful proxy resolution.
|
||||
base::Value NetLogFinishedResolvingProxyParams(const ProxyInfo* result) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("pac_string", result->ToPacString());
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("pac_string", result->ToPacString());
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
// Returns a sanitized copy of |url| which is safe to pass on to a PAC script.
|
||||
@ -1327,12 +1327,11 @@ base::Value::Dict ConfiguredProxyResolutionService::GetProxyNetLogValues() {
|
||||
const std::string& proxy_uri = it.first;
|
||||
const ProxyRetryInfo& retry_info = it.second;
|
||||
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("proxy_uri", proxy_uri);
|
||||
dict.SetStringKey("bad_until",
|
||||
NetLog::TickCountToString(retry_info.bad_until));
|
||||
base::Value::Dict dict;
|
||||
dict.Set("proxy_uri", proxy_uri);
|
||||
dict.Set("bad_until", NetLog::TickCountToString(retry_info.bad_until));
|
||||
|
||||
list.Append(std::move(dict));
|
||||
list.Append(base::Value(std::move(dict)));
|
||||
}
|
||||
|
||||
net_info_dict.Set(kNetInfoBadProxies, std::move(list));
|
||||
|
@ -68,7 +68,7 @@ PacFileDataWithSource& PacFileDataWithSource::operator=(
|
||||
|
||||
base::Value PacFileDecider::PacSource::NetLogParams(
|
||||
const GURL& effective_pac_url) const {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
std::string source;
|
||||
switch (type) {
|
||||
case PacSource::WPAD_DHCP:
|
||||
@ -83,8 +83,8 @@ base::Value PacFileDecider::PacSource::NetLogParams(
|
||||
source += effective_pac_url.possibly_invalid_spec();
|
||||
break;
|
||||
}
|
||||
dict.SetStringKey("source", source);
|
||||
return dict;
|
||||
dict.Set("source", source);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
PacFileDecider::PacFileDecider(PacFileFetcher* pac_file_fetcher,
|
||||
|
@ -23,9 +23,9 @@ namespace {
|
||||
// If |proxies| is non-empty, sets it in |dict| under the key |name|.
|
||||
void AddProxyListToValue(const char* name,
|
||||
const ProxyList& proxies,
|
||||
base::Value* dict) {
|
||||
base::Value::Dict* dict) {
|
||||
if (!proxies.IsEmpty())
|
||||
dict->SetKey(name, proxies.ToValue());
|
||||
dict->Set(name, proxies.ToValue());
|
||||
}
|
||||
|
||||
// Split the |uri_list| on commas and add each entry to |proxy_list| in turn.
|
||||
@ -232,18 +232,18 @@ void ProxyConfig::ClearAutomaticSettings() {
|
||||
}
|
||||
|
||||
base::Value ProxyConfig::ToValue() const {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict;
|
||||
|
||||
// Output the automatic settings.
|
||||
if (auto_detect_)
|
||||
dict.SetBoolKey("auto_detect", auto_detect_);
|
||||
dict.Set("auto_detect", auto_detect_);
|
||||
if (has_pac_url()) {
|
||||
dict.SetStringKey("pac_url", pac_url_.possibly_invalid_spec());
|
||||
dict.Set("pac_url", pac_url_.possibly_invalid_spec());
|
||||
if (pac_mandatory_)
|
||||
dict.SetBoolKey("pac_mandatory", pac_mandatory_);
|
||||
dict.Set("pac_mandatory", pac_mandatory_);
|
||||
}
|
||||
if (from_system_) {
|
||||
dict.SetBoolKey("from_system", from_system_);
|
||||
dict.Set("from_system", from_system_);
|
||||
}
|
||||
|
||||
// Output the manual settings.
|
||||
@ -253,12 +253,12 @@ base::Value ProxyConfig::ToValue() const {
|
||||
AddProxyListToValue("single_proxy", proxy_rules_.single_proxies, &dict);
|
||||
break;
|
||||
case ProxyRules::Type::PROXY_LIST_PER_SCHEME: {
|
||||
base::Value dict2(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict dict2;
|
||||
AddProxyListToValue("http", proxy_rules_.proxies_for_http, &dict2);
|
||||
AddProxyListToValue("https", proxy_rules_.proxies_for_https, &dict2);
|
||||
AddProxyListToValue("ftp", proxy_rules_.proxies_for_ftp, &dict2);
|
||||
AddProxyListToValue("fallback", proxy_rules_.fallback_proxies, &dict2);
|
||||
dict.SetKey("proxy_per_scheme", std::move(dict2));
|
||||
dict.Set("proxy_per_scheme", std::move(dict2));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -269,18 +269,18 @@ base::Value ProxyConfig::ToValue() const {
|
||||
const ProxyBypassRules& bypass = proxy_rules_.bypass_rules;
|
||||
if (!bypass.rules().empty()) {
|
||||
if (proxy_rules_.reverse_bypass)
|
||||
dict.SetBoolKey("reverse_bypass", true);
|
||||
dict.Set("reverse_bypass", true);
|
||||
|
||||
base::Value list(base::Value::Type::LIST);
|
||||
|
||||
for (const auto& bypass_rule : bypass.rules())
|
||||
list.Append(bypass_rule->ToString());
|
||||
|
||||
dict.SetKey("bypass_list", std::move(list));
|
||||
dict.Set("bypass_list", std::move(list));
|
||||
}
|
||||
}
|
||||
|
||||
return dict;
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
@ -201,54 +201,55 @@ class TaskRunnerWithCap : public base::TaskRunner {
|
||||
};
|
||||
|
||||
base::Value NetLogGetAdaptersDoneParams(DhcpAdapterNamesLoggingInfo* info) {
|
||||
base::Value result(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict result;
|
||||
|
||||
// Add information on each of the adapters enumerated (including those that
|
||||
// were subsequently skipped).
|
||||
base::Value adapters_value(base::Value::Type::LIST);
|
||||
base::Value::List adapters_list;
|
||||
for (IP_ADAPTER_ADDRESSES* adapter = info->adapters.get(); adapter;
|
||||
adapter = adapter->Next) {
|
||||
base::Value adapter_value(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict adapter_value;
|
||||
|
||||
adapter_value.SetStringKey("AdapterName", adapter->AdapterName);
|
||||
adapter_value.SetIntKey("IfType", adapter->IfType);
|
||||
adapter_value.SetIntKey("Flags", adapter->Flags);
|
||||
adapter_value.SetIntKey("OperStatus", adapter->OperStatus);
|
||||
adapter_value.SetIntKey("TunnelType", adapter->TunnelType);
|
||||
adapter_value.Set("AdapterName", adapter->AdapterName);
|
||||
adapter_value.Set("IfType", static_cast<int>(adapter->IfType));
|
||||
adapter_value.Set("Flags", static_cast<int>(adapter->Flags));
|
||||
adapter_value.Set("OperStatus", static_cast<int>(adapter->OperStatus));
|
||||
adapter_value.Set("TunnelType", static_cast<int>(adapter->TunnelType));
|
||||
|
||||
// "skipped" means the adapter was not ultimately chosen as a candidate for
|
||||
// testing WPAD.
|
||||
bool skipped = !IsDhcpCapableAdapter(adapter);
|
||||
adapter_value.SetKey("skipped", base::Value(skipped));
|
||||
adapter_value.Set("skipped", base::Value(skipped));
|
||||
|
||||
adapters_value.Append(std::move(adapter_value));
|
||||
adapters_list.Append(std::move(adapter_value));
|
||||
}
|
||||
result.SetKey("adapters", std::move(adapters_value));
|
||||
result.Set("adapters", std::move(adapters_list));
|
||||
|
||||
result.SetIntKey(
|
||||
"origin_to_worker_thread_hop_dt",
|
||||
(info->worker_thread_start_time - info->origin_thread_start_time)
|
||||
.InMilliseconds());
|
||||
result.SetIntKey("worker_to_origin_thread_hop_dt",
|
||||
(info->origin_thread_end_time - info->worker_thread_end_time)
|
||||
.InMilliseconds());
|
||||
result.SetIntKey("worker_dt", (info->worker_thread_end_time -
|
||||
info->worker_thread_start_time)
|
||||
.InMilliseconds());
|
||||
result.Set("origin_to_worker_thread_hop_dt",
|
||||
static_cast<int>((info->worker_thread_start_time -
|
||||
info->origin_thread_start_time)
|
||||
.InMilliseconds()));
|
||||
result.Set("worker_to_origin_thread_hop_dt",
|
||||
static_cast<int>(
|
||||
(info->origin_thread_end_time - info->worker_thread_end_time)
|
||||
.InMilliseconds()));
|
||||
result.Set("worker_dt", static_cast<int>((info->worker_thread_end_time -
|
||||
info->worker_thread_start_time)
|
||||
.InMilliseconds()));
|
||||
|
||||
if (info->error != ERROR_SUCCESS)
|
||||
result.SetIntKey("error", info->error);
|
||||
result.Set("error", static_cast<int>(info->error));
|
||||
|
||||
return result;
|
||||
return base::Value(std::move(result));
|
||||
}
|
||||
|
||||
base::Value NetLogFetcherDoneParams(int fetcher_index, int net_error) {
|
||||
base::Value result(base::Value::Type::DICTIONARY);
|
||||
base::Value::Dict result;
|
||||
|
||||
result.SetIntKey("fetcher_index", fetcher_index);
|
||||
result.SetIntKey("net_error", net_error);
|
||||
result.Set("fetcher_index", fetcher_index);
|
||||
result.Set("net_error", net_error);
|
||||
|
||||
return result;
|
||||
return base::Value(std::move(result));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -283,37 +283,37 @@ LoadStateWithParam URLRequest::GetLoadState() const {
|
||||
}
|
||||
|
||||
base::Value URLRequest::GetStateAsValue() const {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("url", original_url().possibly_invalid_spec());
|
||||
base::Value::Dict dict;
|
||||
dict.Set("url", original_url().possibly_invalid_spec());
|
||||
|
||||
if (url_chain_.size() > 1) {
|
||||
base::Value list(base::Value::Type::LIST);
|
||||
for (const GURL& url : url_chain_) {
|
||||
list.Append(url.possibly_invalid_spec());
|
||||
}
|
||||
dict.SetKey("url_chain", std::move(list));
|
||||
dict.Set("url_chain", std::move(list));
|
||||
}
|
||||
|
||||
dict.SetIntKey("load_flags", load_flags_);
|
||||
dict.Set("load_flags", load_flags_);
|
||||
|
||||
LoadStateWithParam load_state = GetLoadState();
|
||||
dict.SetIntKey("load_state", load_state.state);
|
||||
dict.Set("load_state", load_state.state);
|
||||
if (!load_state.param.empty())
|
||||
dict.SetStringKey("load_state_param", load_state.param);
|
||||
dict.Set("load_state_param", load_state.param);
|
||||
if (!blocked_by_.empty())
|
||||
dict.SetStringKey("delegate_blocked_by", blocked_by_);
|
||||
dict.Set("delegate_blocked_by", blocked_by_);
|
||||
|
||||
dict.SetStringKey("method", method_);
|
||||
dict.SetStringKey("network_isolation_key",
|
||||
isolation_info_.network_isolation_key().ToDebugString());
|
||||
dict.SetBoolKey("has_upload", has_upload());
|
||||
dict.SetBoolKey("is_pending", is_pending_);
|
||||
dict.Set("method", method_);
|
||||
dict.Set("network_isolation_key",
|
||||
isolation_info_.network_isolation_key().ToDebugString());
|
||||
dict.Set("has_upload", has_upload());
|
||||
dict.Set("is_pending", is_pending_);
|
||||
|
||||
dict.SetIntKey("traffic_annotation", traffic_annotation_.unique_id_hash_code);
|
||||
dict.Set("traffic_annotation", traffic_annotation_.unique_id_hash_code);
|
||||
|
||||
if (status_ != OK)
|
||||
dict.SetIntKey("net_error", status_);
|
||||
return dict;
|
||||
dict.Set("net_error", status_);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
void URLRequest::LogBlockedBy(const char* blocked_by) {
|
||||
|
@ -108,18 +108,18 @@ base::Value CookieInclusionStatusNetLogParams(
|
||||
const std::string& cookie_path,
|
||||
const net::CookieInclusionStatus& status,
|
||||
net::NetLogCaptureMode capture_mode) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("operation", operation);
|
||||
dict.SetStringKey("status", status.GetDebugString());
|
||||
base::Value::Dict dict;
|
||||
dict.Set("operation", operation);
|
||||
dict.Set("status", status.GetDebugString());
|
||||
if (net::NetLogCaptureIncludesSensitive(capture_mode)) {
|
||||
if (!cookie_name.empty())
|
||||
dict.SetStringKey("name", cookie_name);
|
||||
dict.Set("name", cookie_name);
|
||||
if (!cookie_domain.empty())
|
||||
dict.SetStringKey("domain", cookie_domain);
|
||||
dict.Set("domain", cookie_domain);
|
||||
if (!cookie_path.empty())
|
||||
dict.SetStringKey("path", cookie_path);
|
||||
dict.Set("path", cookie_path);
|
||||
}
|
||||
return dict;
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
// Records details about the most-specific trust anchor in |spki_hashes|,
|
||||
|
@ -40,9 +40,9 @@ namespace {
|
||||
|
||||
// Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event.
|
||||
base::Value SourceStreamSetParams(SourceStream* source_stream) {
|
||||
base::Value event_params(base::Value::Type::DICTIONARY);
|
||||
event_params.SetStringKey("filters", source_stream->Description());
|
||||
return event_params;
|
||||
base::Value::Dict event_params;
|
||||
event_params.Set("filters", source_stream->Description());
|
||||
return base::Value(std::move(event_params));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -20,11 +20,11 @@ base::Value NetLogURLRequestConstructorParams(
|
||||
const GURL& url,
|
||||
RequestPriority priority,
|
||||
NetworkTrafficAnnotationTag traffic_annotation) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("url", url.possibly_invalid_spec());
|
||||
dict.SetStringKey("priority", RequestPriorityToString(priority));
|
||||
dict.SetIntKey("traffic_annotation", traffic_annotation.unique_id_hash_code);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("url", url.possibly_invalid_spec());
|
||||
dict.Set("priority", RequestPriorityToString(priority));
|
||||
dict.Set("traffic_annotation", traffic_annotation.unique_id_hash_code);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogURLRequestStartParams(
|
||||
@ -35,12 +35,12 @@ base::Value NetLogURLRequestStartParams(
|
||||
const SiteForCookies& site_for_cookies,
|
||||
const absl::optional<url::Origin>& initiator,
|
||||
int64_t upload_id) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("url", url.possibly_invalid_spec());
|
||||
dict.SetStringKey("method", method);
|
||||
dict.SetIntKey("load_flags", load_flags);
|
||||
dict.SetStringKey("network_isolation_key",
|
||||
isolation_info.network_isolation_key().ToDebugString());
|
||||
base::Value::Dict dict;
|
||||
dict.Set("url", url.possibly_invalid_spec());
|
||||
dict.Set("method", method);
|
||||
dict.Set("load_flags", load_flags);
|
||||
dict.Set("network_isolation_key",
|
||||
isolation_info.network_isolation_key().ToDebugString());
|
||||
std::string request_type;
|
||||
switch (isolation_info.request_type()) {
|
||||
case IsolationInfo::RequestType::kMainFrame:
|
||||
@ -53,13 +53,13 @@ base::Value NetLogURLRequestStartParams(
|
||||
request_type = "other";
|
||||
break;
|
||||
}
|
||||
dict.SetStringKey("request_type", request_type);
|
||||
dict.SetStringKey("site_for_cookies", site_for_cookies.ToDebugString());
|
||||
dict.SetStringKey("initiator", initiator.has_value() ? initiator->Serialize()
|
||||
: "not an origin");
|
||||
dict.Set("request_type", request_type);
|
||||
dict.Set("site_for_cookies", site_for_cookies.ToDebugString());
|
||||
dict.Set("initiator",
|
||||
initiator.has_value() ? initiator->Serialize() : "not an origin");
|
||||
if (upload_id > -1)
|
||||
dict.SetStringKey("upload_id", base::NumberToString(upload_id));
|
||||
return dict;
|
||||
dict.Set("upload_id", base::NumberToString(upload_id));
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
@ -54,12 +54,12 @@ const int URLRequestThrottlerEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
|
||||
base::Value NetLogRejectedRequestParams(const std::string* url_id,
|
||||
int num_failures,
|
||||
const base::TimeDelta& release_after) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetStringKey("url", *url_id);
|
||||
dict.SetIntKey("num_failures", num_failures);
|
||||
dict.SetIntKey("release_after_ms",
|
||||
static_cast<int>(release_after.InMilliseconds()));
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("url", *url_id);
|
||||
dict.Set("num_failures", num_failures);
|
||||
dict.Set("release_after_ms",
|
||||
static_cast<int>(release_after.InMilliseconds()));
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
URLRequestThrottlerEntry::URLRequestThrottlerEntry(
|
||||
|
@ -162,10 +162,10 @@ bool ValidateConnection(const HttpResponseHeaders* headers,
|
||||
}
|
||||
|
||||
base::Value NetLogFailureParam(int net_error, const std::string& message) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetIntKey("net_error", net_error);
|
||||
dict.SetStringKey("message", message);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("net_error", net_error);
|
||||
dict.Set("message", message);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -106,22 +106,21 @@ int CalculateSerializedSizeAndTurnOnMaskBit(
|
||||
}
|
||||
|
||||
base::Value NetLogBufferSizeParam(int buffer_size) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetIntKey("read_buffer_size_in_bytes", buffer_size);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("read_buffer_size_in_bytes", buffer_size);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
base::Value NetLogFrameHeaderParam(const WebSocketFrameHeader* header) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetBoolKey("final", header->final);
|
||||
dict.SetBoolKey("reserved1", header->reserved1);
|
||||
dict.SetBoolKey("reserved2", header->reserved2);
|
||||
dict.SetBoolKey("reserved3", header->reserved3);
|
||||
dict.SetIntKey("opcode", header->opcode);
|
||||
dict.SetBoolKey("masked", header->masked);
|
||||
dict.SetDoubleKey("payload_length",
|
||||
static_cast<double>(header->payload_length));
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("final", header->final);
|
||||
dict.Set("reserved1", header->reserved1);
|
||||
dict.Set("reserved2", header->reserved2);
|
||||
dict.Set("reserved3", header->reserved3);
|
||||
dict.Set("opcode", header->opcode);
|
||||
dict.Set("masked", header->masked);
|
||||
dict.Set("payload_length", static_cast<double>(header->payload_length));
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -127,11 +127,11 @@ void GetFrameTypeForOpcode(WebSocketFrameHeader::OpCode opcode,
|
||||
base::Value NetLogFailParam(uint16_t code,
|
||||
base::StringPiece reason,
|
||||
base::StringPiece message) {
|
||||
base::Value dict(base::Value::Type::DICTIONARY);
|
||||
dict.SetDoubleKey("code", code);
|
||||
dict.SetStringKey("reason", reason);
|
||||
dict.SetStringKey("internal_reason", message);
|
||||
return dict;
|
||||
base::Value::Dict dict;
|
||||
dict.Set("code", code);
|
||||
dict.Set("reason", reason);
|
||||
dict.Set("internal_reason", message);
|
||||
return base::Value(std::move(dict));
|
||||
}
|
||||
|
||||
class DependentIOBuffer : public WrappedIOBuffer {
|
||||
|
Reference in New Issue
Block a user