OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_logger.h" | 5 #include "net/base/net_log_logger.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "net/base/load_states_list.h" | 42 #include "net/base/load_states_list.h" |
43 #undef LOAD_STATE | 43 #undef LOAD_STATE |
44 }; | 44 }; |
45 | 45 |
46 const short kNetErrors[] = { | 46 const short kNetErrors[] = { |
47 #define NET_ERROR(label, value) value, | 47 #define NET_ERROR(label, value) value, |
48 #include "net/base/net_error_list.h" | 48 #include "net/base/net_error_list.h" |
49 #undef NET_ERROR | 49 #undef NET_ERROR |
50 }; | 50 }; |
51 | 51 |
| 52 const StringToConstant kSdchProblems[] = { |
| 53 #define SDCH_PROBLEM_CODE(label, value) \ |
| 54 { #label, value } \ |
| 55 , |
| 56 #include "net/base/sdch_problem_code_list.h" |
| 57 #undef SDCH_PROBLEM_CODE |
| 58 }; |
| 59 |
52 } // namespace | 60 } // namespace |
53 | 61 |
54 namespace net { | 62 namespace net { |
55 | 63 |
56 // This should be incremented when significant changes are made that will | 64 // This should be incremented when significant changes are made that will |
57 // invalidate the old loading code. | 65 // invalidate the old loading code. |
58 static const int kLogFormatVersion = 1; | 66 static const int kLogFormatVersion = 1; |
59 | 67 |
60 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) | 68 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) |
61 : file_(file), | 69 : file_(file), |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // symbolic names. | 158 // symbolic names. |
151 { | 159 { |
152 base::DictionaryValue* dict = new base::DictionaryValue(); | 160 base::DictionaryValue* dict = new base::DictionaryValue(); |
153 | 161 |
154 for (size_t i = 0; i < arraysize(kNetErrors); i++) | 162 for (size_t i = 0; i < arraysize(kNetErrors); i++) |
155 dict->SetInteger(ErrorToShortString(kNetErrors[i]), kNetErrors[i]); | 163 dict->SetInteger(ErrorToShortString(kNetErrors[i]), kNetErrors[i]); |
156 | 164 |
157 constants_dict->Set("netError", dict); | 165 constants_dict->Set("netError", dict); |
158 } | 166 } |
159 | 167 |
| 168 // Add information on the relationship between SDCH problem codes and their |
| 169 // symbolic names. |
| 170 { |
| 171 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 172 |
| 173 for (size_t i = 0; i < arraysize(kSdchProblems); i++) |
| 174 dict->SetInteger(kSdchProblems[i].name, kSdchProblems[i].constant); |
| 175 |
| 176 constants_dict->Set("sdchProblemCode", dict); |
| 177 } |
| 178 |
160 // Add information on the relationship between QUIC error codes and their | 179 // Add information on the relationship between QUIC error codes and their |
161 // symbolic names. | 180 // symbolic names. |
162 { | 181 { |
163 base::DictionaryValue* dict = new base::DictionaryValue(); | 182 base::DictionaryValue* dict = new base::DictionaryValue(); |
164 | 183 |
165 for (net::QuicErrorCode error = net::QUIC_NO_ERROR; | 184 for (net::QuicErrorCode error = net::QUIC_NO_ERROR; |
166 error < net::QUIC_LAST_ERROR; | 185 error < net::QUIC_LAST_ERROR; |
167 error = static_cast<net::QuicErrorCode>(error + 1)) { | 186 error = static_cast<net::QuicErrorCode>(error + 1)) { |
168 dict->SetInteger(net::QuicUtils::ErrorToString(error), | 187 dict->SetInteger(net::QuicUtils::ErrorToString(error), |
169 static_cast<int>(error)); | 188 static_cast<int>(error)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 field_trial_groups->AppendString(it->trial_name + ":" + | 289 field_trial_groups->AppendString(it->trial_name + ":" + |
271 it->group_name); | 290 it->group_name); |
272 } | 291 } |
273 constants_dict->Set("activeFieldTrialGroups", field_trial_groups); | 292 constants_dict->Set("activeFieldTrialGroups", field_trial_groups); |
274 } | 293 } |
275 | 294 |
276 return constants_dict; | 295 return constants_dict; |
277 } | 296 } |
278 | 297 |
279 } // namespace net | 298 } // namespace net |
OLD | NEW |