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

Unified Diff: net/nqe/event_creator.h

Issue 2643213003: NQE: Add net log events when there is a significant change in metrics (Closed)
Patch Set: ryansturm comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/nqe/event_creator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/event_creator.h
diff --git a/net/nqe/event_creator.h b/net/nqe/event_creator.h
index 85bbf030f88bfaa7fcabfe9e64ef19cf9f8a2d82..5000195a96d73c1ad5d76a122234cfc786d6bf4a 100644
--- a/net/nqe/event_creator.h
+++ b/net/nqe/event_creator.h
@@ -7,8 +7,13 @@
#include <stdint.h>
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
#include "base/time/time.h"
+#include "net/base/net_export.h"
+#include "net/log/net_log_with_source.h"
#include "net/nqe/effective_connection_type.h"
+#include "net/nqe/network_quality.h"
namespace net {
@@ -18,17 +23,34 @@ namespace nqe {
namespace internal {
-// Adds network quality changed event to the net-internals log. |http_rtt| is
-// the estimate of the HTTP RTT. |transport_rtt| is the estimate of the
-// transport RTT. |downstream_throughput_kbps| is the estimate of the
-// downstream throughput (in kilobits per second). |effective_connection_type|
-// is the current estimate of the effective connection type.
-void AddEffectiveConnectionTypeChangedEventToNetLog(
- const NetLogWithSource& net_log,
- base::TimeDelta http_rtt,
- base::TimeDelta transport_rtt,
- int32_t downstream_throughput_kbps,
- EffectiveConnectionType effective_connection_type);
+// Class that adds net log events for network quality estimator.
+class NET_EXPORT_PRIVATE EventCreator {
+ public:
+ explicit EventCreator(NetLogWithSource net_log);
+ ~EventCreator();
+
+ // May add network quality changed event to the net-internals log if there
+ // is a change in the effective connection type, or if there is a change in
+ // the availability of HTTP RTT, transport RTT or bandwidth.
+ // |effective_connection_type| is the current effective connection type.
+ // |network_quality| is the current network quality.
+ void MaybeAddEffectiveConnectionTypeChangedEventToNetLog(
+ EffectiveConnectionType effective_connection_type,
+ const NetworkQuality& network_quality);
+
+ private:
+ NetLogWithSource net_log_;
+
+ // The effective connection type when the net log event was last added.
+ EffectiveConnectionType past_effective_connection_type_;
+
+ // The network quality when the net log event was last added.
+ NetworkQuality past_network_quality_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventCreator);
+};
} // namespace internal
« no previous file with comments | « no previous file | net/nqe/event_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698