Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_NQE_EVENT_CREATOR_H_ | 5 #ifndef NET_NQE_EVENT_CREATOR_H_ |
| 6 #define NET_NQE_EVENT_CREATOR_H_ | 6 #define NET_NQE_EVENT_CREATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | |
| 11 #include "base/threading/thread_checker.h" | |
| 10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "net/base/net_export.h" | |
| 14 #include "net/log/net_log_with_source.h" | |
| 11 #include "net/nqe/effective_connection_type.h" | 15 #include "net/nqe/effective_connection_type.h" |
| 16 #include "net/nqe/network_quality.h" | |
| 12 | 17 |
| 13 namespace net { | 18 namespace net { |
| 14 | 19 |
| 15 class NetLogWithSource; | 20 class NetLogWithSource; |
| 16 | 21 |
| 17 namespace nqe { | 22 namespace nqe { |
| 18 | 23 |
| 19 namespace internal { | 24 namespace internal { |
| 20 | 25 |
| 21 // Adds network quality changed event to the net-internals log. |http_rtt| is | 26 // Class that adds net log events for network quality estimator. |
| 22 // the estimate of the HTTP RTT. |transport_rtt| is the estimate of the | 27 class NET_EXPORT_PRIVATE EventCreator { |
| 23 // transport RTT. |downstream_throughput_kbps| is the estimate of the | 28 public: |
| 24 // downstream throughput (in kilobits per second). |effective_connection_type| | 29 explicit EventCreator(NetLogWithSource net_log); |
| 25 // is the current estimate of the effective connection type. | 30 ~EventCreator(); |
| 26 void AddEffectiveConnectionTypeChangedEventToNetLog( | 31 |
| 27 const NetLogWithSource& net_log, | 32 // May add network quality changed event to the net-internals log. |
|
RyanSturm
2017/01/25 22:56:50
Add to the comment about either when it will add t
tbansal1
2017/01/26 00:05:45
Done.
| |
| 28 base::TimeDelta http_rtt, | 33 // |effective_connection_type| is the current effective connection type. |
| 29 base::TimeDelta transport_rtt, | 34 // |network_quality| is the current network quality. |
| 30 int32_t downstream_throughput_kbps, | 35 void MaybeAddEffectiveConnectionTypeChangedEventToNetLog( |
| 31 EffectiveConnectionType effective_connection_type); | 36 EffectiveConnectionType effective_connection_type, |
| 37 const NetworkQuality& network_quality); | |
| 38 | |
| 39 private: | |
| 40 NetLogWithSource net_log_; | |
| 41 | |
| 42 // |past_effective_connection_type| is the effective connection type when the | |
|
RyanSturm
2017/01/25 22:56:50
reformat these comments to not reference the varia
tbansal1
2017/01/26 00:05:45
Done.
| |
| 43 // net log event was last added. | |
| 44 EffectiveConnectionType past_effective_connection_type_; | |
| 45 | |
| 46 // |past_network_quality_| is the network quality when the net log event was | |
| 47 // last added. | |
| 48 NetworkQuality past_network_quality_; | |
| 49 | |
| 50 base::ThreadChecker thread_checker_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(EventCreator); | |
| 53 }; | |
| 32 | 54 |
| 33 } // namespace internal | 55 } // namespace internal |
| 34 | 56 |
| 35 } // namespace nqe | 57 } // namespace nqe |
| 36 | 58 |
| 37 } // namespace net | 59 } // namespace net |
| 38 | 60 |
| 39 #endif // NET_NQE_EVENT_CREATOR_H_ | 61 #endif // NET_NQE_EVENT_CREATOR_H_ |
| OLD | NEW |