Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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. | |
|
bengr
2015/07/21 00:06:48
Add a blank line.
tbansal1
2015/07/21 16:18:25
Done.
| |
| 4 #ifndef CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ | |
| 5 #define CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ | |
| 6 | |
| 7 #include <jni.h> | |
| 8 | |
| 9 #include "base/android/scoped_java_ref.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "base/threading/thread_checker.h" | |
| 13 #include "base/time/time.h" | |
| 14 | |
| 15 // Native class that calls Java code exposed by | |
| 16 // NetworkQualityProviderHelper.java. | |
| 17 class NetworkQualityProvider { | |
| 18 public: | |
| 19 // Constructs and initializes the underlying provider. | |
| 20 NetworkQualityProvider(); | |
| 21 | |
| 22 virtual ~NetworkQualityProvider(); | |
| 23 | |
| 24 // Returns true only if network quality estimate is available. | |
| 25 bool IsEstimateAvailable(); | |
| 26 | |
| 27 // Returns the expected RTT duration. | |
| 28 // Returns base::TimeDelta() if the estimate is unavailable. | |
| 29 base::TimeDelta GetRTT(); | |
| 30 | |
| 31 // Returns the expected downstream throughput (in Kbps). | |
| 32 // Returns 0 if the estimate is unavailable. | |
|
bengr
2015/07/21 00:06:48
Why not return -1. 0 is a valid estimate, no?
tbansal1
2015/07/21 16:18:25
good point, rewrote.
| |
| 33 int GetDownstreamThroughputKbps(); | |
| 34 | |
| 35 // Returns the expected upstream throughput (in Kbps). | |
| 36 // Returns 0 if the estimate is unavailable. | |
|
bengr
2015/07/21 00:06:48
Same here.
tbansal1
2015/07/21 16:18:25
Done.
| |
| 37 int GetUpstreamThroughputKbps(); | |
| 38 | |
| 39 // Returns time since network quality was last updated. | |
| 40 // Return value should be discarded if the estimate is unavailable. | |
|
bengr
2015/07/21 00:06:48
You could assert that IsEstimateAvailable is calle
tbansal1
2015/07/21 16:18:25
Done.
| |
| 41 base::TimeDelta GetTimeSinceLastUpdate(); | |
| 42 | |
| 43 private: | |
| 44 base::android::ScopedJavaGlobalRef<jobject> j_network_quality_provider_; | |
| 45 | |
| 46 base::ThreadChecker thread_checker_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(NetworkQualityProvider); | |
| 49 }; | |
| 50 | |
| 51 bool RegisterNetworkQualityProvider(JNIEnv* env); | |
| 52 | |
| 53 #endif // CHROME_BROWSER_ANDROID_NET_NETWORK_QUALITY_PROVIDER_H_ | |
| OLD | NEW |