OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/quic/quic_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> |
9 #include <utility> | 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
15 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
16 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 base::ListValue* missing = new base::ListValue(); | 121 base::ListValue* missing = new base::ListValue(); |
121 dict->Set("packets", missing); | 122 dict->Set("packets", missing); |
122 for (QuicPacketNumber packet : frame->packets) | 123 for (QuicPacketNumber packet : frame->packets) |
123 missing->AppendString(base::Uint64ToString(packet)); | 124 missing->AppendString(base::Uint64ToString(packet)); |
124 | 125 |
125 base::ListValue* received = new base::ListValue(); | 126 base::ListValue* received = new base::ListValue(); |
126 dict->Set("received_packet_times", received); | 127 dict->Set("received_packet_times", received); |
127 const PacketTimeVector& received_times = frame->received_packet_times; | 128 const PacketTimeVector& received_times = frame->received_packet_times; |
128 for (PacketTimeVector::const_iterator it = received_times.begin(); | 129 for (PacketTimeVector::const_iterator it = received_times.begin(); |
129 it != received_times.end(); ++it) { | 130 it != received_times.end(); ++it) { |
130 base::DictionaryValue* info = new base::DictionaryValue(); | 131 std::unique_ptr<base::DictionaryValue> info(new base::DictionaryValue()); |
131 info->SetInteger("packet_number", static_cast<int>(it->first)); | 132 info->SetInteger("packet_number", static_cast<int>(it->first)); |
132 info->SetString("received", | 133 info->SetString("received", |
133 base::Int64ToString(it->second.ToDebuggingValue())); | 134 base::Int64ToString(it->second.ToDebuggingValue())); |
134 received->Append(info); | 135 received->Append(std::move(info)); |
135 } | 136 } |
136 | 137 |
137 return std::move(dict); | 138 return std::move(dict); |
138 } | 139 } |
139 | 140 |
140 std::unique_ptr<base::Value> NetLogQuicRstStreamFrameCallback( | 141 std::unique_ptr<base::Value> NetLogQuicRstStreamFrameCallback( |
141 const QuicRstStreamFrame* frame, | 142 const QuicRstStreamFrame* frame, |
142 NetLogCaptureMode /* capture_mode */) { | 143 NetLogCaptureMode /* capture_mode */) { |
143 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 144 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
144 dict->SetInteger("stream_id", frame->stream_id); | 145 dict->SetInteger("stream_id", frame->stream_id); |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 continue; | 873 continue; |
873 } | 874 } |
874 // Record some overlapping patterns, to get a better picture, since this is | 875 // Record some overlapping patterns, to get a better picture, since this is |
875 // not very expensive. | 876 // not very expensive. |
876 if (i % 3 == 0) | 877 if (i % 3 == 0) |
877 six_packet_histogram->Add(recent_6_mask); | 878 six_packet_histogram->Add(recent_6_mask); |
878 } | 879 } |
879 } | 880 } |
880 | 881 |
881 } // namespace net | 882 } // namespace net |
OLD | NEW |