Chromium Code Reviews| 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/metrics/field_trial.h" | |
| 12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "net/base/address_family.h" | 15 #include "net/base/address_family.h" |
| 15 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
| 16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 17 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.h" |
| 18 #include "net/quic/quic_utils.h" | 19 #include "net/quic/quic_utils.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 std::string json; | 98 std::string json; |
| 98 base::JSONWriter::Write(value.get(), &json); | 99 base::JSONWriter::Write(value.get(), &json); |
| 99 fprintf(file_.get(), "%s%s", | 100 fprintf(file_.get(), "%s%s", |
| 100 (added_events_ ? ",\n" : ""), | 101 (added_events_ ? ",\n" : ""), |
| 101 json.c_str()); | 102 json.c_str()); |
| 102 added_events_ = true; | 103 added_events_ = true; |
| 103 } | 104 } |
| 104 | 105 |
| 105 base::DictionaryValue* NetLogLogger::GetConstants() { | 106 base::DictionaryValue* NetLogLogger::GetConstants() { |
| 106 base::DictionaryValue* constants_dict = new base::DictionaryValue(); | 107 base::DictionaryValue* constants_dict = new base::DictionaryValue(); |
| 107 | |
|
xunjieli
2014/10/23 19:56:25
I will revert this edit in the next patch.
| |
| 108 // Version of the file format. | 108 // Version of the file format. |
| 109 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); | 109 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); |
| 110 | 110 |
| 111 // Add a dictionary with information on the relationship between event type | 111 // Add a dictionary with information on the relationship between event type |
| 112 // enums and their symbolic names. | 112 // enums and their symbolic names. |
| 113 constants_dict->Set("logEventTypes", net::NetLog::GetEventTypesAsValue()); | 113 constants_dict->Set("logEventTypes", net::NetLog::GetEventTypesAsValue()); |
| 114 | 114 |
| 115 // Add a dictionary with information about the relationship between CertStatus | 115 // Add a dictionary with information about the relationship between CertStatus |
| 116 // flags and their symbolic names. | 116 // flags and their symbolic names. |
| 117 { | 117 { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 | 251 |
| 252 // Pass it as a string, since it may be too large to fit in an integer. | 252 // Pass it as a string, since it may be too large to fit in an integer. |
| 253 constants_dict->SetString("timeTickOffset", | 253 constants_dict->SetString("timeTickOffset", |
| 254 base::Int64ToString(tick_to_unix_time_ms)); | 254 base::Int64ToString(tick_to_unix_time_ms)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 // "clientInfo" key is required for some NetLogLogger log readers. | 257 // "clientInfo" key is required for some NetLogLogger log readers. |
| 258 // Provide a default empty value for compatibility. | 258 // Provide a default empty value for compatibility. |
| 259 constants_dict->Set("clientInfo", new base::DictionaryValue()); | 259 constants_dict->Set("clientInfo", new base::DictionaryValue()); |
| 260 | 260 |
| 261 // Add a list of active field experiments. | |
| 262 { | |
| 263 base::FieldTrial::ActiveGroups active_groups; | |
| 264 base::FieldTrialList::GetActiveFieldTrialGroups(&active_groups); | |
| 265 base::ListValue* field_trial_groups = new base::ListValue(); | |
| 266 for (size_t i = 0; i < active_groups.size(); i++) { | |
| 267 field_trial_groups->AppendString(active_groups[i].group_name + ":" + | |
| 268 active_groups[i].trial_name); | |
| 269 } | |
| 270 constants_dict->Set("activeFieldTrialGroups", field_trial_groups); | |
| 271 } | |
| 272 | |
| 261 return constants_dict; | 273 return constants_dict; |
| 262 } | 274 } |
| 263 | 275 |
| 264 } // namespace net | 276 } // namespace net |
| OLD | NEW |