Commit 6fa12f99 authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Convert more instances of base::DictionaryValue in //net.

Bug: 646113
Change-Id: I7ba7eb2950593576f6552b3a681a74437f6bffa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1616150Reviewed-by: default avatarDavid Benjamin <davidben@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660675}
parent bf1f6c0d
This diff is collapsed.
......@@ -37,11 +37,11 @@ base::Value NetLogSpdyStreamErrorCallback(
int net_error,
const std::string* description,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict;
dict.SetInteger("stream_id", static_cast<int>(stream_id));
dict.SetString("net_error", ErrorToShortString(net_error));
dict.SetString("description", *description);
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetIntKey("stream_id", static_cast<int>(stream_id));
dict.SetStringKey("net_error", ErrorToShortString(net_error));
dict.SetStringKey("description", *description);
return dict;
}
base::Value NetLogSpdyStreamWindowUpdateCallback(
......@@ -49,11 +49,11 @@ base::Value NetLogSpdyStreamWindowUpdateCallback(
int32_t delta,
int32_t window_size,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict;
dict.SetInteger("stream_id", stream_id);
dict.SetInteger("delta", delta);
dict.SetInteger("window_size", window_size);
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetIntKey("stream_id", stream_id);
dict.SetIntKey("delta", delta);
dict.SetIntKey("window_size", window_size);
return dict;
}
} // namespace
......
......@@ -281,53 +281,52 @@ LoadStateWithParam URLRequest::GetLoadState() const {
}
base::Value URLRequest::GetStateAsValue() const {
base::DictionaryValue dict;
dict.SetString("url", original_url().possibly_invalid_spec());
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("url", original_url().possibly_invalid_spec());
if (url_chain_.size() > 1) {
base::ListValue list;
base::Value list(base::Value::Type::LIST);
for (const GURL& url : url_chain_) {
list.AppendString(url.possibly_invalid_spec());
list.GetList().emplace_back(url.possibly_invalid_spec());
}
dict.SetKey("url_chain", std::move(list));
}
dict.SetInteger("load_flags", load_flags_);
dict.SetIntKey("load_flags", load_flags_);
LoadStateWithParam load_state = GetLoadState();
dict.SetInteger("load_state", load_state.state);
dict.SetIntKey("load_state", load_state.state);
if (!load_state.param.empty())
dict.SetString("load_state_param", load_state.param);
dict.SetStringKey("load_state_param", load_state.param);
if (!blocked_by_.empty())
dict.SetString("delegate_blocked_by", blocked_by_);
dict.SetStringKey("delegate_blocked_by", blocked_by_);
dict.SetString("method", method_);
dict.SetBoolean("has_upload", has_upload());
dict.SetBoolean("is_pending", is_pending_);
dict.SetStringKey("method", method_);
dict.SetBoolKey("has_upload", has_upload());
dict.SetBoolKey("is_pending", is_pending_);
dict.SetInteger("traffic_annotation",
traffic_annotation_.unique_id_hash_code);
dict.SetIntKey("traffic_annotation", traffic_annotation_.unique_id_hash_code);
// Add the status of the request. The status should always be IO_PENDING, and
// the error should always be OK, unless something is holding onto a request
// that has finished or a request was leaked. Neither of these should happen.
switch (status_.status()) {
case URLRequestStatus::SUCCESS:
dict.SetString("status", "SUCCESS");
dict.SetStringKey("status", "SUCCESS");
break;
case URLRequestStatus::IO_PENDING:
dict.SetString("status", "IO_PENDING");
dict.SetStringKey("status", "IO_PENDING");
break;
case URLRequestStatus::CANCELED:
dict.SetString("status", "CANCELED");
dict.SetStringKey("status", "CANCELED");
break;
case URLRequestStatus::FAILED:
dict.SetString("status", "FAILED");
dict.SetStringKey("status", "FAILED");
break;
}
if (status_.error() != OK)
dict.SetInteger("net_error", status_.error());
return std::move(dict);
dict.SetIntKey("net_error", status_.error());
return dict;
}
void URLRequest::LogBlockedBy(const char* blocked_by) {
......
......@@ -37,9 +37,9 @@ namespace {
// Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event.
base::Value SourceStreamSetCallback(SourceStream* source_stream,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue event_params;
event_params.SetString("filters", source_stream->Description());
return std::move(event_params);
base::Value event_params(base::Value::Type::DICTIONARY);
event_params.SetStringKey("filters", source_stream->Description());
return event_params;
}
} // namespace
......
......@@ -18,11 +18,11 @@ base::Value NetLogURLRequestConstructorCallback(
RequestPriority priority,
NetworkTrafficAnnotationTag traffic_annotation,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict;
dict.SetString("url", url->possibly_invalid_spec());
dict.SetString("priority", RequestPriorityToString(priority));
dict.SetInteger("traffic_annotation", traffic_annotation.unique_id_hash_code);
return std::move(dict);
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 NetLogURLRequestStartCallback(
......@@ -32,14 +32,14 @@ base::Value NetLogURLRequestStartCallback(
PrivacyMode privacy_mode,
int64_t upload_id,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict;
dict.SetString("url", url->possibly_invalid_spec());
dict.SetString("method", *method);
dict.SetInteger("load_flags", load_flags);
dict.SetInteger("privacy_mode", privacy_mode == PRIVACY_MODE_ENABLED);
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.SetIntKey("privacy_mode", privacy_mode == PRIVACY_MODE_ENABLED);
if (upload_id > -1)
dict.SetString("upload_id", base::NumberToString(upload_id));
return std::move(dict);
dict.SetStringKey("upload_id", base::NumberToString(upload_id));
return dict;
}
} // namespace net
......@@ -56,12 +56,12 @@ base::Value NetLogRejectedRequestCallback(
int num_failures,
const base::TimeDelta& release_after,
NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict;
dict.SetString("url", *url_id);
dict.SetInteger("num_failures", num_failures);
dict.SetInteger("release_after_ms",
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 std::move(dict);
return dict;
}
URLRequestThrottlerEntry::URLRequestThrottlerEntry(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment