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( ...@@ -37,11 +37,11 @@ base::Value NetLogSpdyStreamErrorCallback(
int net_error, int net_error,
const std::string* description, const std::string* description,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetInteger("stream_id", static_cast<int>(stream_id)); dict.SetIntKey("stream_id", static_cast<int>(stream_id));
dict.SetString("net_error", ErrorToShortString(net_error)); dict.SetStringKey("net_error", ErrorToShortString(net_error));
dict.SetString("description", *description); dict.SetStringKey("description", *description);
return std::move(dict); return dict;
} }
base::Value NetLogSpdyStreamWindowUpdateCallback( base::Value NetLogSpdyStreamWindowUpdateCallback(
...@@ -49,11 +49,11 @@ base::Value NetLogSpdyStreamWindowUpdateCallback( ...@@ -49,11 +49,11 @@ base::Value NetLogSpdyStreamWindowUpdateCallback(
int32_t delta, int32_t delta,
int32_t window_size, int32_t window_size,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetInteger("stream_id", stream_id); dict.SetIntKey("stream_id", stream_id);
dict.SetInteger("delta", delta); dict.SetIntKey("delta", delta);
dict.SetInteger("window_size", window_size); dict.SetIntKey("window_size", window_size);
return std::move(dict); return dict;
} }
} // namespace } // namespace
......
...@@ -281,53 +281,52 @@ LoadStateWithParam URLRequest::GetLoadState() const { ...@@ -281,53 +281,52 @@ LoadStateWithParam URLRequest::GetLoadState() const {
} }
base::Value URLRequest::GetStateAsValue() const { base::Value URLRequest::GetStateAsValue() const {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetString("url", original_url().possibly_invalid_spec()); dict.SetStringKey("url", original_url().possibly_invalid_spec());
if (url_chain_.size() > 1) { if (url_chain_.size() > 1) {
base::ListValue list; base::Value list(base::Value::Type::LIST);
for (const GURL& url : url_chain_) { 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.SetKey("url_chain", std::move(list));
} }
dict.SetInteger("load_flags", load_flags_); dict.SetIntKey("load_flags", load_flags_);
LoadStateWithParam load_state = GetLoadState(); LoadStateWithParam load_state = GetLoadState();
dict.SetInteger("load_state", load_state.state); dict.SetIntKey("load_state", load_state.state);
if (!load_state.param.empty()) 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()) if (!blocked_by_.empty())
dict.SetString("delegate_blocked_by", blocked_by_); dict.SetStringKey("delegate_blocked_by", blocked_by_);
dict.SetString("method", method_); dict.SetStringKey("method", method_);
dict.SetBoolean("has_upload", has_upload()); dict.SetBoolKey("has_upload", has_upload());
dict.SetBoolean("is_pending", is_pending_); dict.SetBoolKey("is_pending", is_pending_);
dict.SetInteger("traffic_annotation", dict.SetIntKey("traffic_annotation", traffic_annotation_.unique_id_hash_code);
traffic_annotation_.unique_id_hash_code);
// Add the status of the request. The status should always be IO_PENDING, and // 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 // 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. // that has finished or a request was leaked. Neither of these should happen.
switch (status_.status()) { switch (status_.status()) {
case URLRequestStatus::SUCCESS: case URLRequestStatus::SUCCESS:
dict.SetString("status", "SUCCESS"); dict.SetStringKey("status", "SUCCESS");
break; break;
case URLRequestStatus::IO_PENDING: case URLRequestStatus::IO_PENDING:
dict.SetString("status", "IO_PENDING"); dict.SetStringKey("status", "IO_PENDING");
break; break;
case URLRequestStatus::CANCELED: case URLRequestStatus::CANCELED:
dict.SetString("status", "CANCELED"); dict.SetStringKey("status", "CANCELED");
break; break;
case URLRequestStatus::FAILED: case URLRequestStatus::FAILED:
dict.SetString("status", "FAILED"); dict.SetStringKey("status", "FAILED");
break; break;
} }
if (status_.error() != OK) if (status_.error() != OK)
dict.SetInteger("net_error", status_.error()); dict.SetIntKey("net_error", status_.error());
return std::move(dict); return dict;
} }
void URLRequest::LogBlockedBy(const char* blocked_by) { void URLRequest::LogBlockedBy(const char* blocked_by) {
......
...@@ -37,9 +37,9 @@ namespace { ...@@ -37,9 +37,9 @@ namespace {
// Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event. // Callback for TYPE_URL_REQUEST_FILTERS_SET net-internals event.
base::Value SourceStreamSetCallback(SourceStream* source_stream, base::Value SourceStreamSetCallback(SourceStream* source_stream,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue event_params; base::Value event_params(base::Value::Type::DICTIONARY);
event_params.SetString("filters", source_stream->Description()); event_params.SetStringKey("filters", source_stream->Description());
return std::move(event_params); return event_params;
} }
} // namespace } // namespace
......
...@@ -18,11 +18,11 @@ base::Value NetLogURLRequestConstructorCallback( ...@@ -18,11 +18,11 @@ base::Value NetLogURLRequestConstructorCallback(
RequestPriority priority, RequestPriority priority,
NetworkTrafficAnnotationTag traffic_annotation, NetworkTrafficAnnotationTag traffic_annotation,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetString("url", url->possibly_invalid_spec()); dict.SetStringKey("url", url->possibly_invalid_spec());
dict.SetString("priority", RequestPriorityToString(priority)); dict.SetStringKey("priority", RequestPriorityToString(priority));
dict.SetInteger("traffic_annotation", traffic_annotation.unique_id_hash_code); dict.SetIntKey("traffic_annotation", traffic_annotation.unique_id_hash_code);
return std::move(dict); return dict;
} }
base::Value NetLogURLRequestStartCallback( base::Value NetLogURLRequestStartCallback(
...@@ -32,14 +32,14 @@ base::Value NetLogURLRequestStartCallback( ...@@ -32,14 +32,14 @@ base::Value NetLogURLRequestStartCallback(
PrivacyMode privacy_mode, PrivacyMode privacy_mode,
int64_t upload_id, int64_t upload_id,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetString("url", url->possibly_invalid_spec()); dict.SetStringKey("url", url->possibly_invalid_spec());
dict.SetString("method", *method); dict.SetStringKey("method", *method);
dict.SetInteger("load_flags", load_flags); dict.SetIntKey("load_flags", load_flags);
dict.SetInteger("privacy_mode", privacy_mode == PRIVACY_MODE_ENABLED); dict.SetIntKey("privacy_mode", privacy_mode == PRIVACY_MODE_ENABLED);
if (upload_id > -1) if (upload_id > -1)
dict.SetString("upload_id", base::NumberToString(upload_id)); dict.SetStringKey("upload_id", base::NumberToString(upload_id));
return std::move(dict); return dict;
} }
} // namespace net } // namespace net
...@@ -56,12 +56,12 @@ base::Value NetLogRejectedRequestCallback( ...@@ -56,12 +56,12 @@ base::Value NetLogRejectedRequestCallback(
int num_failures, int num_failures,
const base::TimeDelta& release_after, const base::TimeDelta& release_after,
NetLogCaptureMode /* capture_mode */) { NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue dict; base::Value dict(base::Value::Type::DICTIONARY);
dict.SetString("url", *url_id); dict.SetStringKey("url", *url_id);
dict.SetInteger("num_failures", num_failures); dict.SetIntKey("num_failures", num_failures);
dict.SetInteger("release_after_ms", dict.SetIntKey("release_after_ms",
static_cast<int>(release_after.InMilliseconds())); static_cast<int>(release_after.InMilliseconds()));
return std::move(dict); return dict;
} }
URLRequestThrottlerEntry::URLRequestThrottlerEntry( 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