Chromium Code Reviews| Index: net/base/net_log_util.cc |
| diff --git a/net/base/net_log_util.cc b/net/base/net_log_util.cc |
| index b8816bad919441a12428d49f79ffb19ddb6027bc..62b905826cd0febc78c1bd7d1a7b7d0e0306a166 100644 |
| --- a/net/base/net_log_util.cc |
| +++ b/net/base/net_log_util.cc |
| @@ -43,19 +43,25 @@ struct StringToConstant { |
| }; |
| const StringToConstant kCertStatusFlags[] = { |
| -#define CERT_STATUS_FLAG(label, value) { #label, value }, |
| +#define CERT_STATUS_FLAG(label, value) \ |
| + { #label, value } \ |
| + , |
| #include "net/cert/cert_status_flags_list.h" |
| #undef CERT_STATUS_FLAG |
| }; |
| const StringToConstant kLoadFlags[] = { |
| -#define LOAD_FLAG(label, value) { #label, value }, |
| +#define LOAD_FLAG(label, value) \ |
| + { #label, value } \ |
| + , |
|
mmenke
2014/12/02 19:22:29
The placement of the comma here is really weird.
|
| #include "net/base/load_flags_list.h" |
| #undef LOAD_FLAG |
| }; |
| const StringToConstant kLoadStateTable[] = { |
| -#define LOAD_STATE(label) { # label, net::LOAD_STATE_ ## label }, |
| +#define LOAD_STATE(label) \ |
| + { #label, net::LOAD_STATE_##label } \ |
| + , |
| #include "net/base/load_states_list.h" |
| #undef LOAD_STATE |
| }; |
| @@ -68,11 +74,11 @@ const short kNetErrors[] = { |
| const char* NetInfoSourceToString(NetInfoSource source) { |
| switch (source) { |
| - #define NET_INFO_SOURCE(label, string, value) \ |
| - case NET_INFO_ ## label: \ |
| - return string; |
| +#define NET_INFO_SOURCE(label, string, value) \ |
| + case NET_INFO_##label: \ |
| + return string; |
| #include "net/base/net_info_source_list.h" |
| - #undef NET_INFO_SOURCE |
| +#undef NET_INFO_SOURCE |
| case NET_INFO_ALL_SOURCES: |
| return "All"; |
| } |
| @@ -139,10 +145,10 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { |
| { |
| base::DictionaryValue* dict = new base::DictionaryValue(); |
| - #define NET_INFO_SOURCE(label, string, value) \ |
| - dict->SetInteger(string, NET_INFO_ ## label); |
| +#define NET_INFO_SOURCE(label, string, value) \ |
| + dict->SetInteger(string, NET_INFO_##label); |
| #include "net/base/net_info_source_list.h" |
| - #undef NET_INFO_SOURCE |
| +#undef NET_INFO_SOURCE |
| constants_dict->Set("netInfoSources", dict); |
| } |
| @@ -223,10 +229,8 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { |
| dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", |
| net::ADDRESS_FAMILY_UNSPECIFIED); |
| - dict->SetInteger("ADDRESS_FAMILY_IPV4", |
| - net::ADDRESS_FAMILY_IPV4); |
| - dict->SetInteger("ADDRESS_FAMILY_IPV6", |
| - net::ADDRESS_FAMILY_IPV6); |
| + dict->SetInteger("ADDRESS_FAMILY_IPV4", net::ADDRESS_FAMILY_IPV4); |
| + dict->SetInteger("ADDRESS_FAMILY_IPV6", net::ADDRESS_FAMILY_IPV6); |
| constants_dict->Set("addressFamily", dict); |
| } |
| @@ -267,8 +271,7 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { |
| for (base::FieldTrial::ActiveGroups::const_iterator it = |
| active_groups.begin(); |
| it != active_groups.end(); ++it) { |
| - field_trial_groups->AppendString(it->trial_name + ":" + |
| - it->group_name); |
| + field_trial_groups->AppendString(it->trial_name + ":" + it->group_name); |
| } |
| constants_dict->Set("activeFieldTrialGroups", field_trial_groups); |
| } |
| @@ -277,7 +280,8 @@ scoped_ptr<base::DictionaryValue> GetNetConstants() { |
| } |
| NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| - URLRequestContext* context, int info_sources) { |
| + URLRequestContext* context, |
| + int info_sources) { |
| scoped_ptr<base::DictionaryValue> net_info_dict(new base::DictionaryValue()); |
| // TODO(mmenke): The code for most of these sources should probably be moved |
| @@ -332,9 +336,8 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| base::DictionaryValue* cache_info_dict = new base::DictionaryValue(); |
| - cache_info_dict->SetInteger( |
| - "capacity", |
| - static_cast<int>(cache->max_entries())); |
| + cache_info_dict->SetInteger("capacity", |
| + static_cast<int>(cache->max_entries())); |
| base::ListValue* entry_list = new base::ListValue(); |
| @@ -347,7 +350,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| entry_dict->SetString("hostname", key.hostname); |
| entry_dict->SetInteger("address_family", |
| - static_cast<int>(key.address_family)); |
| + static_cast<int>(key.address_family)); |
| entry_dict->SetString("expiration", |
| net::NetLog::TickCountToString(it.expiration())); |
| @@ -376,12 +379,12 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| if (info_sources & NET_INFO_SOCKET_POOL) { |
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_SOCKET_POOL), |
| - http_network_session->SocketPoolInfoToValue()); |
| + http_network_session->SocketPoolInfoToValue()); |
| } |
| if (info_sources & NET_INFO_SPDY_SESSIONS) { |
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_SPDY_SESSIONS), |
| - http_network_session->SpdySessionPoolInfoToValue()); |
| + http_network_session->SpdySessionPoolInfoToValue()); |
| } |
| if (info_sources & NET_INFO_SPDY_STATUS) { |
| @@ -392,12 +395,10 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| status_dict->SetBoolean( |
| "use_alternate_protocols", |
| http_network_session->params().use_alternate_protocols); |
| - status_dict->SetBoolean( |
| - "force_spdy_over_ssl", |
| - http_network_session->params().force_spdy_over_ssl); |
| - status_dict->SetBoolean( |
| - "force_spdy_always", |
| - http_network_session->params().force_spdy_always); |
| + status_dict->SetBoolean("force_spdy_over_ssl", |
| + http_network_session->params().force_spdy_over_ssl); |
| + status_dict->SetBoolean("force_spdy_always", |
| + http_network_session->params().force_spdy_always); |
| std::vector<std::string> next_protos; |
| http_network_session->GetNextProtos(&next_protos); |
| @@ -405,7 +406,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| status_dict->SetString("next_protos", next_protos_string); |
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_SPDY_STATUS), |
| - status_dict); |
| + status_dict); |
| } |
| if (info_sources & NET_INFO_SPDY_ALT_PROTO_MAPPINGS) { |
| @@ -418,7 +419,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| http_server_properties.alternate_protocol_map(); |
| for (net::AlternateProtocolMap::const_iterator it = map.begin(); |
| - it != map.end(); ++it) { |
| + it != map.end(); ++it) { |
| base::DictionaryValue* dict = new base::DictionaryValue(); |
| dict->SetString("host_port_pair", it->first.ToString()); |
| dict->SetString("alternate_protocol", it->second.ToString()); |
| @@ -431,7 +432,7 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| if (info_sources & NET_INFO_QUIC) { |
| net_info_dict->Set(NetInfoSourceToString(NET_INFO_QUIC), |
| - http_network_session->QuicInfoToValue()); |
| + http_network_session->QuicInfoToValue()); |
| } |
| if (info_sources & NET_INFO_HTTP_CACHE) { |
| @@ -445,14 +446,13 @@ NET_EXPORT scoped_ptr<base::DictionaryValue> GetNetInfo( |
| base::StringPairs stats; |
| disk_cache->GetStats(&stats); |
| for (size_t i = 0; i < stats.size(); ++i) { |
| - stats_dict->SetStringWithoutPathExpansion( |
| - stats[i].first, stats[i].second); |
| + stats_dict->SetStringWithoutPathExpansion(stats[i].first, |
| + stats[i].second); |
| } |
| } |
| info_dict->Set("stats", stats_dict); |
| - net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), |
| - info_dict); |
| + net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), info_dict); |
| } |
| return net_info_dict.Pass(); |