Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: net/base/net_log_util.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary include Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 #include "net/disk_cache/disk_cache.h" 19 #include "net/disk_cache/disk_cache.h"
19 #include "net/dns/host_cache.h" 20 #include "net/dns/host_cache.h"
20 #include "net/dns/host_resolver.h" 21 #include "net/dns/host_resolver.h"
21 #include "net/http/http_cache.h" 22 #include "net/http/http_cache.h"
22 #include "net/http/http_network_session.h" 23 #include "net/http/http_network_session.h"
23 #include "net/http/http_server_properties.h" 24 #include "net/http/http_server_properties.h"
24 #include "net/http/http_transaction_factory.h" 25 #include "net/http/http_transaction_factory.h"
25 #include "net/proxy/proxy_config.h" 26 #include "net/proxy/proxy_config.h"
26 #include "net/proxy/proxy_retry_info.h" 27 #include "net/proxy/proxy_retry_info.h"
27 #include "net/proxy/proxy_service.h" 28 #include "net/proxy/proxy_service.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "net/base/load_states_list.h" 60 #include "net/base/load_states_list.h"
60 #undef LOAD_STATE 61 #undef LOAD_STATE
61 }; 62 };
62 63
63 const short kNetErrors[] = { 64 const short kNetErrors[] = {
64 #define NET_ERROR(label, value) value, 65 #define NET_ERROR(label, value) value,
65 #include "net/base/net_error_list.h" 66 #include "net/base/net_error_list.h"
66 #undef NET_ERROR 67 #undef NET_ERROR
67 }; 68 };
68 69
70 const StringToConstant kSdchProblems[] = {
71 #define SDCH_PROBLEM_CODE(label, value) { #label, value },
72 #include "net/base/sdch_problem_code_list.h"
73 #undef SDCH_PROBLEM_CODE
74 };
75
69 const char* NetInfoSourceToString(NetInfoSource source) { 76 const char* NetInfoSourceToString(NetInfoSource source) {
70 switch (source) { 77 switch (source) {
71 #define NET_INFO_SOURCE(label, string, value) \ 78 #define NET_INFO_SOURCE(label, string, value) \
72 case NET_INFO_ ## label: \ 79 case NET_INFO_ ## label: \
73 return string; 80 return string;
74 #include "net/base/net_info_source_list.h" 81 #include "net/base/net_info_source_list.h"
75 #undef NET_INFO_SOURCE 82 #undef NET_INFO_SOURCE
76 case NET_INFO_ALL_SOURCES: 83 case NET_INFO_ALL_SOURCES:
77 return "All"; 84 return "All";
78 } 85 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR; 187 for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR;
181 error < net::QUIC_STREAM_LAST_ERROR; 188 error < net::QUIC_STREAM_LAST_ERROR;
182 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) { 189 error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) {
183 dict->SetInteger(net::QuicUtils::StreamErrorToString(error), 190 dict->SetInteger(net::QuicUtils::StreamErrorToString(error),
184 static_cast<int>(error)); 191 static_cast<int>(error));
185 } 192 }
186 193
187 constants_dict->Set("quicRstStreamError", dict); 194 constants_dict->Set("quicRstStreamError", dict);
188 } 195 }
189 196
197 // Add information on the relationship between SDCH problem codes and their
198 // symbolic names.
199 {
200 base::DictionaryValue* dict = new base::DictionaryValue();
201
202 for (size_t i = 0; i < arraysize(kSdchProblems); i++)
203 dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant);
204
205 constants_dict->Set("sdchProblemCode", dict);
206 }
207
190 // Information about the relationship between event phase enums and their 208 // Information about the relationship between event phase enums and their
191 // symbolic names. 209 // symbolic names.
192 { 210 {
193 base::DictionaryValue* dict = new base::DictionaryValue(); 211 base::DictionaryValue* dict = new base::DictionaryValue();
194 212
195 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); 213 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN);
196 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); 214 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END);
197 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); 215 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE);
198 216
199 constants_dict->Set("logEventPhase", dict); 217 constants_dict->Set("logEventPhase", dict);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 stats_dict->SetStringWithoutPathExpansion( 466 stats_dict->SetStringWithoutPathExpansion(
449 stats[i].first, stats[i].second); 467 stats[i].first, stats[i].second);
450 } 468 }
451 } 469 }
452 info_dict->Set("stats", stats_dict); 470 info_dict->Set("stats", stats_dict);
453 471
454 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE), 472 net_info_dict->Set(NetInfoSourceToString(NET_INFO_HTTP_CACHE),
455 info_dict); 473 info_dict);
456 } 474 }
457 475
476 if (info_sources & NET_INFO_SDCH) {
477 base::Value* info_dict = nullptr;
mmenke 2014/10/30 21:18:52 nit: No need to initialize. We're in trouble if
478 SdchManager* sdch_manager = context->sdch_manager();
479 if (sdch_manager) {
480 info_dict = sdch_manager->SdchInfoToValue();
481 } else {
482 info_dict = new base::DictionaryValue();
483 }
484 net_info_dict->Set(NetInfoSourceToString(NET_INFO_SDCH),
485 info_dict);
486 }
487
458 return net_info_dict.Pass(); 488 return net_info_dict.Pass();
459 } 489 }
460 490
461 } // namespace net 491 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698