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

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

Issue 2593243003: Add network quality change events to net log (Closed)
Patch Set: ps 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 "base/bind.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/values.h"
10 #include "net/log/net_log_with_source.h"
11
12 namespace net {
13
14 namespace nqe {
15
16 namespace internal {
17
18 namespace {
19
20 std::unique_ptr<base::Value> EffectiveConnectionTypeChangedNetLogCallback(
RyanSturm 2017/01/10 16:22:37 #include <memory>
tbansal1 2017/01/10 18:27:52 Done.
21 base::TimeDelta http_rtt,
22 base::TimeDelta transport_rtt,
23 int32_t downstream_throughput_kbps,
24 EffectiveConnectionType effective_connection_type,
25 NetLogCaptureMode capture_mode) {
RyanSturm 2017/01/10 16:22:37 #include "net/log/net_log_capture_mode.h" since it
tbansal1 2017/01/10 18:27:52 Done.
26 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
27 dict->SetString("http_rtt",
28 base::IntToString(http_rtt.InMilliseconds()) + " msec");
29 dict->SetString("transport_rtt",
30 base::IntToString(transport_rtt.InMilliseconds()) + " msec");
31 dict->SetString("downstream_throughput",
32 base::IntToString(downstream_throughput_kbps) + " kbps");
33 dict->SetString("effective_connection_type",
34 GetNameForEffectiveConnectionType(effective_connection_type));
35 return std::move(dict);
RyanSturm 2017/01/10 16:22:37 maybe #include <utility>
tbansal1 2017/01/10 18:27:52 Done.
36 }
37
38 } // namespace
39
40 void AddEffectiveConnectionTypeChangedEventToNetLog(
41 const NetLogWithSource& net_log,
42 base::TimeDelta http_rtt,
43 base::TimeDelta transport_rtt,
44 int32_t downstream_throughput_kbps,
45 EffectiveConnectionType effective_connection_type) {
46 net_log.AddEvent(
47 NetLogEventType::NETWORK_QUALITY_CHANGED,
48 base::Bind(&EffectiveConnectionTypeChangedNetLogCallback, http_rtt,
49 transport_rtt, downstream_throughput_kbps,
50 effective_connection_type));
51 }
52
53 } // namespace internal
54
55 } // namespace nqe
56
57 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698