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