OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_log_util.h" | 5 #include "net/base/net_log_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "net/base/address_family.h" | 14 #include "net/base/address_family.h" |
15 #include "net/base/load_states.h" | 15 #include "net/base/load_states.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/base/net_log.h" | 17 #include "net/base/net_log.h" |
18 #include "net/base/sdch_manager.h" | |
19 #include "net/disk_cache/disk_cache.h" | 18 #include "net/disk_cache/disk_cache.h" |
20 #include "net/dns/host_cache.h" | 19 #include "net/dns/host_cache.h" |
21 #include "net/dns/host_resolver.h" | 20 #include "net/dns/host_resolver.h" |
22 #include "net/http/http_cache.h" | 21 #include "net/http/http_cache.h" |
23 #include "net/http/http_network_session.h" | 22 #include "net/http/http_network_session.h" |
24 #include "net/http/http_server_properties.h" | 23 #include "net/http/http_server_properties.h" |
25 #include "net/http/http_transaction_factory.h" | 24 #include "net/http/http_transaction_factory.h" |
26 #include "net/proxy/proxy_config.h" | 25 #include "net/proxy/proxy_config.h" |
27 #include "net/proxy/proxy_retry_info.h" | 26 #include "net/proxy/proxy_retry_info.h" |
28 #include "net/proxy/proxy_service.h" | 27 #include "net/proxy/proxy_service.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "net/base/load_states_list.h" | 59 #include "net/base/load_states_list.h" |
61 #undef LOAD_STATE | 60 #undef LOAD_STATE |
62 }; | 61 }; |
63 | 62 |
64 const short kNetErrors[] = { | 63 const short kNetErrors[] = { |
65 #define NET_ERROR(label, value) value, | 64 #define NET_ERROR(label, value) value, |
66 #include "net/base/net_error_list.h" | 65 #include "net/base/net_error_list.h" |
67 #undef NET_ERROR | 66 #undef NET_ERROR |
68 }; | 67 }; |
69 | 68 |
70 const StringToConstant kSdchProblems[] = { | |
71 #define SDCH_PROBLEM_CODE(label, value) \ | |
72 { #label, value } \ | |
73 , | |
74 #include "net/base/sdch_problem_code_list.h" | |
75 #undef SDCH_PROBLEM_CODE | |
76 }; | |
77 | |
78 const char* NetInfoSourceToString(NetInfoSource source) { | 69 const char* NetInfoSourceToString(NetInfoSource source) { |
79 switch (source) { | 70 switch (source) { |
80 #define NET_INFO_SOURCE(label, string, value) \ | 71 #define NET_INFO_SOURCE(label, string, value) \ |
81 case NET_INFO_ ## label: \ | 72 case NET_INFO_ ## label: \ |
82 return string; | 73 return string; |
83 #include "net/base/net_info_source_list.h" | 74 #include "net/base/net_info_source_list.h" |
84 #undef NET_INFO_SOURCE | 75 #undef NET_INFO_SOURCE |
85 case NET_INFO_ALL_SOURCES: | 76 case NET_INFO_ALL_SOURCES: |
86 return "All"; | 77 return "All"; |
87 } | 78 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR; | 180 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR; |
190 error < net::QUIC_STREAM_LAST_ERROR; | 181 error < net::QUIC_STREAM_LAST_ERROR; |
191 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) { | 182 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) { |
192 dict->SetInteger(net::QuicUtils::StreamErrorToString(error), | 183 dict->SetInteger(net::QuicUtils::StreamErrorToString(error), |
193 static_cast<int>(error)); | 184 static_cast<int>(error)); |
194 } | 185 } |
195 | 186 |
196 constants_dict->Set("quicRstStreamError", dict); | 187 constants_dict->Set("quicRstStreamError", dict); |
197 } | 188 } |
198 | 189 |
199 // Add information on the relationship between SDCH problem codes and their | |
200 // symbolic names. | |
201 { | |
202 base::DictionaryValue* dict = new base::DictionaryValue(); | |
203 | |
204 for (size_t i = 0; i < arraysize(kSdchProblems); i++) | |
205 dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant); | |
206 | |
207 constants_dict->Set("sdchProblemCode", dict); | |
208 } | |
209 | |
210 // Information about the relationship between event phase enums and their | 190 // Information about the relationship between event phase enums and their |
211 // symbolic names. | 191 // symbolic names. |
212 { | 192 { |
213 base::DictionaryValue* dict = new base::DictionaryValue(); | 193 base::DictionaryValue* dict = new base::DictionaryValue(); |
214 | 194 |
215 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); | 195 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); |
216 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); | 196 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); |
217 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); | 197 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); |
218 | 198 |
219 constants_dict->Set("logEventPhase", dict); | 199 constants_dict->Set("logEventPhase", dict); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 stats_dict->SetStringWithoutPathExpansion( | 448 stats_dict->SetStringWithoutPathExpansion( |
469 stats[i].first, stats[i].second); | 449 stats[i].first, stats[i].second); |
470 } | 450 } |
471 } | 451 } |
472 info_dict->Set("stats", stats_dict); | 452 info_dict->Set("stats", stats_dict); |
473 | 453 |
474 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), | 454 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), |
475 info_dict); | 455 info_dict); |
476 } | 456 } |
477 | 457 |
478 if (info_sources & NET_INFO_SDCH) { | |
479 base::Value* info_dict; | |
480 SdchManager* sdch_manager = context->sdch_manager(); | |
481 if (sdch_manager) { | |
482 info_dict = sdch_manager->SdchInfoToValue(); | |
483 } else { | |
484 info_dict = new base::DictionaryValue(); | |
485 } | |
486 net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH), info_dict); | |
487 } | |
488 | |
489 return net_info_dict.Pass(); | 458 return net_info_dict.Pass(); |
490 } | 459 } |
491 | 460 |
492 } // namespace net | 461 } // namespace net |
OLD | NEW |