Chromium Code Reviews| 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/log/net_log_util.h" | 5 #include "net/log/net_log_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 if (request1->creation_time() > request2->creation_time()) | 122 if (request1->creation_time() > request2->creation_time()) |
| 123 return false; | 123 return false; |
| 124 // If requests were created at the same time, sort by ID. Mostly matters for | 124 // If requests were created at the same time, sort by ID. Mostly matters for |
| 125 // testing purposes. | 125 // testing purposes. |
| 126 return request1->identifier() < request2->identifier(); | 126 return request1->identifier() < request2->identifier(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Returns a Value representing the state of a pre-existing URLRequest when | 129 // Returns a Value representing the state of a pre-existing URLRequest when |
| 130 // net-internals was opened. | 130 // net-internals was opened. |
| 131 base::Value* GetRequestStateAsValue(const net::URLRequest* request, | 131 base::Value* GetRequestStateAsValue(const net::URLRequest* request, |
| 132 net::NetLog::LogLevel log_level) { | 132 net::NetLogCaptureMode capture_mode) { |
| 133 return request->GetStateAsValue(); | 133 return request->GetStateAsValue(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace | 136 } // namespace |
| 137 | 137 |
| 138 scoped_ptr<base::DictionaryValue> GetNetConstants() { | 138 scoped_ptr<base::DictionaryValue> GetNetConstants() { |
| 139 scoped_ptr<base::DictionaryValue> constants_dict(new base::DictionaryValue()); | 139 scoped_ptr<base::DictionaryValue> constants_dict(new base::DictionaryValue()); |
| 140 | 140 |
| 141 // Version of the file format. | 141 // Version of the file format. |
| 142 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); | 142 constants_dict->SetInteger("logFormatVersion", kLogFormatVersion); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); | 247 dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN); |
| 248 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); | 248 dict->SetInteger("PHASE_END", net::NetLog::PHASE_END); |
| 249 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); | 249 dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE); |
| 250 | 250 |
| 251 constants_dict->Set("logEventPhase", dict); | 251 constants_dict->Set("logEventPhase", dict); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Information about the relationship between source type enums and | 254 // Information about the relationship between source type enums and |
| 255 // their symbolic names. | 255 // their symbolic names. |
| 256 constants_dict->Set("logSourceType", net::NetLog::GetSourceTypesAsValue()); | 256 constants_dict->Set("logSourceType", net::NetLog::GetSourceTypesAsValue()); |
| 257 | 257 |
|
mmenke
2015/04/17 15:16:06
Removing the block breaks loading newer logs with
eroman
2015/04/17 19:20:50
Oh right, good point! Done
| |
| 258 // Information about the relationship between LogLevel enums and their | |
| 259 // symbolic names. | |
| 260 { | |
| 261 base::DictionaryValue* dict = new base::DictionaryValue(); | |
| 262 | |
| 263 dict->SetInteger("LOG_ALL", net::NetLog::LOG_ALL); | |
| 264 dict->SetInteger("LOG_ALL_BUT_BYTES", net::NetLog::LOG_ALL_BUT_BYTES); | |
| 265 dict->SetInteger("LOG_STRIP_PRIVATE_DATA", | |
| 266 net::NetLog::LOG_STRIP_PRIVATE_DATA); | |
| 267 | |
| 268 constants_dict->Set("logLevelType", dict); | |
| 269 } | |
| 270 | |
| 271 // Information about the relationship between address family enums and | 258 // Information about the relationship between address family enums and |
| 272 // their symbolic names. | 259 // their symbolic names. |
| 273 { | 260 { |
| 274 base::DictionaryValue* dict = new base::DictionaryValue(); | 261 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 275 | 262 |
| 276 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", | 263 dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", |
| 277 net::ADDRESS_FAMILY_UNSPECIFIED); | 264 net::ADDRESS_FAMILY_UNSPECIFIED); |
| 278 dict->SetInteger("ADDRESS_FAMILY_IPV4", net::ADDRESS_FAMILY_IPV4); | 265 dict->SetInteger("ADDRESS_FAMILY_IPV4", net::ADDRESS_FAMILY_IPV4); |
| 279 dict->SetInteger("ADDRESS_FAMILY_IPV6", net::ADDRESS_FAMILY_IPV6); | 266 dict->SetInteger("ADDRESS_FAMILY_IPV6", net::ADDRESS_FAMILY_IPV6); |
| 280 | 267 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 | 518 |
| 532 // Create fake events. | 519 // Create fake events. |
| 533 ScopedVector<NetLog::Entry> entries; | 520 ScopedVector<NetLog::Entry> entries; |
| 534 for (const auto& request : requests) { | 521 for (const auto& request : requests) { |
| 535 net::NetLog::ParametersCallback callback = | 522 net::NetLog::ParametersCallback callback = |
| 536 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); | 523 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); |
| 537 | 524 |
| 538 net::NetLog::EntryData entry_data( | 525 net::NetLog::EntryData entry_data( |
| 539 net::NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), | 526 net::NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), |
| 540 net::NetLog::PHASE_BEGIN, request->creation_time(), &callback); | 527 net::NetLog::PHASE_BEGIN, request->creation_time(), &callback); |
| 541 NetLog::Entry entry(&entry_data, request->net_log().GetLogLevel()); | 528 NetLog::Entry entry(&entry_data, request->net_log().GetCaptureMode()); |
| 542 observer->OnAddEntry(entry); | 529 observer->OnAddEntry(entry); |
| 543 } | 530 } |
| 544 } | 531 } |
| 545 | 532 |
| 546 } // namespace net | 533 } // namespace net |
| OLD | NEW |