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

Unified Diff: net/base/network_change_notifier.h

Issue 2814473002: Move HttpStreamFactoryImpl::JobController UMA to a schedule upload (Closed)
Patch Set: add test Created 3 years, 8 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 | « net/android/network_change_notifier_android.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.h
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h
index a758cc3acf30c0400368d81280248e5971d0d8e7..8701b99fd366ab1b51233a73b7795ef98c7ff2d9 100644
--- a/net/base/network_change_notifier.h
+++ b/net/base/network_change_notifier.h
@@ -247,6 +247,21 @@ class NET_EXPORT NetworkChangeNotifier {
DISALLOW_COPY_AND_ASSIGN(NetworkObserver);
};
+ // An interface that when implemented and added via AddMetricsObserver(),
+ // provides notifications when metrics are cut. The callback is called
+ // asynchronously on observer's thread.
+ class NET_EXPORT MetricsObserver {
+ public:
+ virtual void OnMetricsFinalize() = 0;
+
+ protected:
+ MetricsObserver() {}
+ virtual ~MetricsObserver() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MetricsObserver);
+ };
+
// An invalid NetworkHandle.
static const NetworkHandle kInvalidNetworkHandle;
@@ -379,6 +394,7 @@ class NET_EXPORT NetworkChangeNotifier {
static void AddDNSObserver(DNSObserver* observer);
static void AddNetworkChangeObserver(NetworkChangeObserver* observer);
static void AddMaxBandwidthObserver(MaxBandwidthObserver* observer);
+ static void AddMetricsObserver(MetricsObserver* observer);
static void AddNetworkObserver(NetworkObserver* observer);
// Unregisters |observer| from receiving notifications. This must be called
@@ -517,7 +533,7 @@ class NET_EXPORT NetworkChangeNotifier {
// Hook that allows derived implementations to log histograms at the time a
// new histogram record is being finalized.
- virtual void OnFinalizingMetricsLogRecord() {}
+ virtual void OnFinalizingMetricsLogRecord();
// Broadcasts a notification to all registered observers. Note that this
// happens asynchronously, even for observers on the current thread, even in
@@ -554,6 +570,8 @@ class NET_EXPORT NetworkChangeNotifier {
void NotifyObserversOfNetworkChangeImpl(ConnectionType type);
void NotifyObserversOfMaxBandwidthChangeImpl(double max_bandwidth_mbps,
ConnectionType type);
+ void NotifyObserversOfMetricsOnFinalize();
+
void NotifyObserversOfSpecificNetworkChangeImpl(NetworkChangeType type,
NetworkHandle network);
@@ -569,6 +587,8 @@ class NET_EXPORT NetworkChangeNotifier {
max_bandwidth_observer_list_;
const scoped_refptr<base::ObserverListThreadSafe<NetworkObserver>>
network_observer_list_;
+ const scoped_refptr<base::ObserverListThreadSafe<MetricsObserver>>
+ metrics_observer_list_;
// The current network state. Hosts DnsConfig, exposed via GetDnsConfig.
std::unique_ptr<NetworkState> network_state_;
« no previous file with comments | « net/android/network_change_notifier_android.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698