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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.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/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
17 #include "net/quic/quic_utils.h" | 18 #include "net/quic/quic_utils.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 // This should be incremented when significant changes are made that will | 22 // This should be incremented when significant changes are made that will |
22 // invalidate the old loading code. | 23 // invalidate the old loading code. |
23 static const int kLogFormatVersion = 1; | 24 static const int kLogFormatVersion = 1; |
24 | 25 |
25 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) | 26 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 114 |
114 constants_dict->Set("loadState", dict); | 115 constants_dict->Set("loadState", dict); |
115 } | 116 } |
116 | 117 |
117 // Add information on the relationship between net error codes and their | 118 // Add information on the relationship between net error codes and their |
118 // symbolic names. | 119 // symbolic names. |
119 { | 120 { |
120 base::DictionaryValue* dict = new base::DictionaryValue(); | 121 base::DictionaryValue* dict = new base::DictionaryValue(); |
121 | 122 |
122 #define NET_ERROR(label, value) \ | 123 #define NET_ERROR(label, value) \ |
123 dict->SetInteger(# label, static_cast<int>(value)); | 124 dict->SetInteger(ErrorToShortString(value), static_cast<int>(value)); |
124 #include "net/base/net_error_list.h" | 125 #include "net/base/net_error_list.h" |
125 #undef NET_ERROR | 126 #undef NET_ERROR |
126 | 127 |
127 constants_dict->Set("netError", dict); | 128 constants_dict->Set("netError", dict); |
128 } | 129 } |
129 | 130 |
130 // Add information on the relationship between QUIC error codes and their | 131 // Add information on the relationship between QUIC error codes and their |
131 // symbolic names. | 132 // symbolic names. |
132 { | 133 { |
133 base::DictionaryValue* dict = new base::DictionaryValue(); | 134 base::DictionaryValue* dict = new base::DictionaryValue(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 227 } |
227 | 228 |
228 // "clientInfo" key is required for some NetLogLogger log readers. | 229 // "clientInfo" key is required for some NetLogLogger log readers. |
229 // Provide a default empty value for compatibility. | 230 // Provide a default empty value for compatibility. |
230 constants_dict->Set("clientInfo", new base::DictionaryValue()); | 231 constants_dict->Set("clientInfo", new base::DictionaryValue()); |
231 | 232 |
232 return constants_dict; | 233 return constants_dict; |
233 } | 234 } |
234 | 235 |
235 } // namespace net | 236 } // namespace net |
OLD | NEW |