blob: b71c0d520f019a10bbd711dc8abc3989b632b40a [file] [log] [blame]
tbansal97e38a22017-01-20 20:43:021// 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#ifndef NET_NQE_EVENT_CREATOR_H_
6#define NET_NQE_EVENT_CREATOR_H_
7
8#include <stdint.h>
9
tbansal781262f2017-01-26 14:21:2110#include "base/macros.h"
Tarun Bansalc71cf622018-10-16 16:24:4411#include "base/sequence_checker.h"
tbansal781262f2017-01-26 14:21:2112#include "net/base/net_export.h"
13#include "net/log/net_log_with_source.h"
tbansal97e38a22017-01-20 20:43:0214#include "net/nqe/effective_connection_type.h"
tbansal781262f2017-01-26 14:21:2115#include "net/nqe/network_quality.h"
tbansal97e38a22017-01-20 20:43:0216
17namespace net {
18
19class NetLogWithSource;
20
21namespace nqe {
22
23namespace internal {
24
tbansal781262f2017-01-26 14:21:2125// Class that adds net log events for network quality estimator.
26class NET_EXPORT_PRIVATE EventCreator {
27 public:
28 explicit EventCreator(NetLogWithSource net_log);
Peter Boström293b1342021-09-22 17:31:4329
30 EventCreator(const EventCreator&) = delete;
31 EventCreator& operator=(const EventCreator&) = delete;
32
tbansal781262f2017-01-26 14:21:2133 ~EventCreator();
34
35 // May add network quality changed event to the net-internals log if there
tbansalf38471f2017-03-04 01:07:0436 // is a change in the effective connection type, or if there is a meaningful
37 // change in the values of HTTP RTT, transport RTT or bandwidth.
tbansal781262f2017-01-26 14:21:2138 // |effective_connection_type| is the current effective connection type.
39 // |network_quality| is the current network quality.
tbansalf38471f2017-03-04 01:07:0440 void MaybeAddNetworkQualityChangedEventToNetLog(
tbansal781262f2017-01-26 14:21:2141 EffectiveConnectionType effective_connection_type,
42 const NetworkQuality& network_quality);
43
44 private:
45 NetLogWithSource net_log_;
46
47 // The effective connection type when the net log event was last added.
48 EffectiveConnectionType past_effective_connection_type_;
49
50 // The network quality when the net log event was last added.
51 NetworkQuality past_network_quality_;
52
Tarun Bansalc71cf622018-10-16 16:24:4453 SEQUENCE_CHECKER(sequence_checker_);
tbansal781262f2017-01-26 14:21:2154};
tbansal97e38a22017-01-20 20:43:0255
56} // namespace internal
57
58} // namespace nqe
59
60} // namespace net
61
62#endif // NET_NQE_EVENT_CREATOR_H_