Commit b976d5e3 authored by David Benjamin's avatar David Benjamin Committed by Commit Bot

Convert uses of DictionaryValue in net/socket

Bug: 646113
Change-Id: I3c6c52586080a053e390ca27b08d53fb777cd69f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1737428
Auto-Submit: David Benjamin <davidben@chromium.org>
Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: David Benjamin <davidben@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684376}
parent 0d154c3f
......@@ -140,9 +140,9 @@ void ClientSocketPool::NetLogTcpClientSocketPoolRequestedSocket(
}
base::Value ClientSocketPool::NetLogGroupIdParams(const GroupId& group_id) {
base::DictionaryValue event_params;
event_params.SetString("group_id", group_id.ToString());
return std::move(event_params);
base::Value event_params(base::Value::Type::DICTIONARY);
event_params.SetStringKey("group_id", group_id.ToString());
return event_params;
}
std::unique_ptr<ConnectJob> ClientSocketPool::CreateConnectJob(
......
......@@ -17,10 +17,10 @@
namespace net {
base::Value NetLogSocketErrorParams(int net_error, int os_error) {
base::DictionaryValue dict;
dict.SetInteger("net_error", net_error);
dict.SetInteger("os_error", os_error);
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetIntKey("net_error", net_error);
dict.SetIntKey("os_error", os_error);
return dict;
}
void NetLogSocketError(const NetLogWithSource& net_log,
......@@ -32,25 +32,25 @@ void NetLogSocketError(const NetLogWithSource& net_log,
}
base::Value CreateNetLogHostPortPairParams(const HostPortPair* host_and_port) {
base::DictionaryValue dict;
dict.SetString("host_and_port", host_and_port->ToString());
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("host_and_port", host_and_port->ToString());
return dict;
}
base::Value CreateNetLogIPEndPointParams(const IPEndPoint* address) {
base::DictionaryValue dict;
dict.SetString("address", address->ToString());
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("address", address->ToString());
return dict;
}
base::Value CreateNetLogSourceAddressParams(const struct sockaddr* net_address,
socklen_t address_len) {
base::DictionaryValue dict;
base::Value dict(base::Value::Type::DICTIONARY);
IPEndPoint ipe;
bool result = ipe.FromSockAddr(net_address, address_len);
DCHECK(result);
dict.SetString("source_address", ipe.ToString());
return std::move(dict);
dict.SetStringKey("source_address", ipe.ToString());
return dict;
}
} // namespace net
......@@ -86,11 +86,11 @@ const int kDefaultOpenSSLBufferSize = 17 * 1024;
base::Value NetLogPrivateKeyOperationParams(uint16_t algorithm,
SSLPrivateKey* key) {
base::DictionaryValue value;
value.SetString("algorithm", SSL_get_signature_algorithm_name(
algorithm, 0 /* exclude curve */));
value.SetString("provider", key->GetProviderName());
return std::move(value);
base::Value value(base::Value::Type::DICTIONARY);
value.SetStringKey("algorithm", SSL_get_signature_algorithm_name(
algorithm, 0 /* exclude curve */));
value.SetStringKey("provider", key->GetProviderName());
return value;
}
base::Value NetLogSSLInfoParams(SSLClientSocketImpl* socket) {
......@@ -98,42 +98,42 @@ base::Value NetLogSSLInfoParams(SSLClientSocketImpl* socket) {
if (!socket->GetSSLInfo(&ssl_info))
return base::Value();
base::DictionaryValue dict;
base::Value dict(base::Value::Type::DICTIONARY);
const char* version_str;
SSLVersionToString(&version_str,
SSLConnectionStatusToVersion(ssl_info.connection_status));
dict.SetString("version", version_str);
dict.SetBoolean("is_resumed",
dict.SetStringKey("version", version_str);
dict.SetBoolKey("is_resumed",
ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME);
dict.SetInteger("cipher_suite",
SSLConnectionStatusToCipherSuite(ssl_info.connection_status));
dict.SetIntKey("cipher_suite",
SSLConnectionStatusToCipherSuite(ssl_info.connection_status));
dict.SetString("next_proto",
NextProtoToString(socket->GetNegotiatedProtocol()));
dict.SetStringKey("next_proto",
NextProtoToString(socket->GetNegotiatedProtocol()));
return std::move(dict);
return dict;
}
base::Value NetLogSSLAlertParams(const void* bytes, size_t len) {
base::DictionaryValue dict;
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("bytes", NetLogBinaryValue(bytes, len));
return std::move(dict);
return dict;
}
base::Value NetLogSSLMessageParams(bool is_write,
const void* bytes,
size_t len,
NetLogCaptureMode capture_mode) {
base::DictionaryValue dict;
base::Value dict(base::Value::Type::DICTIONARY);
if (len == 0) {
NOTREACHED();
return std::move(dict);
return dict;
}
// The handshake message type is the first byte. Include it so elided messages
// still report their type.
uint8_t type = reinterpret_cast<const uint8_t*>(bytes)[0];
dict.SetInteger("type", type);
dict.SetIntKey("type", type);
// Elide client certificate messages unless logging socket bytes. The client
// certificate does not contain information needed to impersonate the user
......@@ -144,7 +144,7 @@ base::Value NetLogSSLMessageParams(bool is_write,
dict.SetKey("bytes", NetLogBinaryValue(bytes, len));
}
return std::move(dict);
return dict;
}
// This enum is used in histograms, so values may not be reused.
......
......@@ -41,10 +41,10 @@ bool g_connect_backup_jobs_enabled = true;
base::Value NetLogCreateConnectJobParams(
bool backup_job,
const ClientSocketPool::GroupId* group_id) {
base::DictionaryValue dict;
dict.SetBoolean("backup_job", backup_job);
dict.SetString("group_id", group_id->ToString());
return std::move(dict);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetBoolKey("backup_job", backup_job);
dict.SetStringKey("group_id", group_id->ToString());
return dict;
}
} // namespace
......
......@@ -19,23 +19,23 @@ base::Value NetLogUDPDataTransferParams(int byte_count,
const char* bytes,
const IPEndPoint* address,
NetLogCaptureMode capture_mode) {
base::DictionaryValue dict;
dict.SetInteger("byte_count", byte_count);
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetIntKey("byte_count", byte_count);
if (NetLogCaptureIncludesSocketBytes(capture_mode))
dict.SetKey("bytes", NetLogBinaryValue(bytes, byte_count));
if (address)
dict.SetString("address", address->ToString());
return std::move(dict);
dict.SetStringKey("address", address->ToString());
return dict;
}
base::Value NetLogUDPConnectParams(
const IPEndPoint& address,
NetworkChangeNotifier::NetworkHandle network) {
base::DictionaryValue dict;
dict.SetString("address", address.ToString());
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("address", address.ToString());
if (network != NetworkChangeNotifier::kInvalidNetworkHandle)
dict.SetInteger("bound_to_network", network);
return std::move(dict);
dict.SetIntKey("bound_to_network", network);
return dict;
}
} // namespace
......
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