Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: net/nqe/event_creator.cc

Issue 2593243003: Add network quality change events to net log (Closed)
Patch Set: Rebased, using net log source Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/nqe/event_creator.h"
6
7 #include <memory>
8 #include <utility>
9
10 #include "base/bind.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h"
13 #include "net/log/net_log_capture_mode.h"
14 #include "net/log/net_log_with_source.h"
15
16 namespace net {
17
18 namespace nqe {
19
20 namespace internal {
21
22 namespace {
23
24 std::unique_ptr<base::Value> EffectiveConnectionTypeChangedNetLogCallback(
25 base::TimeDelta http_rtt,
26 base::TimeDelta transport_rtt,
27 int32_t downstream_throughput_kbps,
28 EffectiveConnectionType effective_connection_type,
29 NetLogCaptureMode capture_mode) {
30 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
31 dict->SetString("http_rtt",
32 base::IntToString(http_rtt.InMilliseconds()) + " msec");
eroman 2017/01/19 23:57:24 Rather than setting this as a string parameter, ca
tbansal1 2017/01/20 01:30:34 Done.
33 dict->SetString("transport_rtt",
34 base::IntToString(transport_rtt.InMilliseconds()) + " msec");
35 dict->SetString("downstream_throughput",
36 base::IntToString(downstream_throughput_kbps) + " kbps");
eroman 2017/01/19 23:57:24 Same thing here and throughout.
tbansal1 2017/01/20 01:30:34 Done.
37 dict->SetString("effective_connection_type",
38 GetNameForEffectiveConnectionType(effective_connection_type));
39 return std::move(dict);
40 }
41
42 } // namespace
43
44 void AddEffectiveConnectionTypeChangedEventToNetLog(
45 const NetLogWithSource& net_log,
46 base::TimeDelta http_rtt,
47 base::TimeDelta transport_rtt,
48 int32_t downstream_throughput_kbps,
49 EffectiveConnectionType effective_connection_type) {
50 net_log.AddEvent(
51 NetLogEventType::NETWORK_QUALITY_CHANGED,
52 base::Bind(&EffectiveConnectionTypeChangedNetLogCallback, http_rtt,
53 transport_rtt, downstream_throughput_kbps,
54 effective_connection_type));
55 }
56
57 } // namespace internal
58
59 } // namespace nqe
60
61 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698