| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 DCHECK_EQ((*contexts.begin())->net_log(), context->net_log()); | 507 DCHECK_EQ((*contexts.begin())->net_log(), context->net_log()); |
| 508 for (const auto& request : *context->url_requests()) { | 508 for (const auto& request : *context->url_requests()) { |
| 509 requests.push_back(request); | 509 requests.push_back(request); |
| 510 } | 510 } |
| 511 } | 511 } |
| 512 | 512 |
| 513 // Sort by creation time. | 513 // Sort by creation time. |
| 514 std::sort(requests.begin(), requests.end(), RequestCreatedBefore); | 514 std::sort(requests.begin(), requests.end(), RequestCreatedBefore); |
| 515 | 515 |
| 516 // Create fake events. | 516 // Create fake events. |
| 517 ScopedVector<NetLog::Entry> entries; | |
| 518 for (const auto& request : requests) { | 517 for (const auto& request : requests) { |
| 519 NetLog::ParametersCallback callback = | 518 NetLog::ParametersCallback callback = |
| 520 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); | 519 base::Bind(&GetRequestStateAsValue, base::Unretained(request)); |
| 521 | 520 |
| 522 // Note that passing the hardcoded NetLogCaptureMode::Default() below is | 521 // Note that passing the hardcoded NetLogCaptureMode::Default() below is |
| 523 // fine, since GetRequestStateAsValue() ignores the capture mode. | 522 // fine, since GetRequestStateAsValue() ignores the capture mode. |
| 524 NetLog::EntryData entry_data( | 523 NetLog::EntryData entry_data( |
| 525 NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), | 524 NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(), |
| 526 NetLog::PHASE_BEGIN, request->creation_time(), &callback); | 525 NetLog::PHASE_BEGIN, request->creation_time(), &callback); |
| 527 NetLog::Entry entry(&entry_data, NetLogCaptureMode::Default()); | 526 NetLog::Entry entry(&entry_data, NetLogCaptureMode::Default()); |
| 528 observer->OnAddEntry(entry); | 527 observer->OnAddEntry(entry); |
| 529 } | 528 } |
| 530 } | 529 } |
| 531 | 530 |
| 532 } // namespace net | 531 } // namespace net |
| OLD | NEW |