Commit c1c13d3a authored by mgersh's avatar mgersh Committed by Commit bot

Delete old NetworkQualityEstimator Cronet API

Now that RequestFinishedListener doesn't depend on NQE's executor, the
rest of this API can go away.

BUG=618034

Review-Url: https://codereview.chromium.org/2188553002
Cr-Commit-Position: refs/heads/master@{#408754}
parent 91307343
......@@ -958,34 +958,6 @@ public abstract class CronetEngine {
*/
public abstract byte[] getGlobalMetricsDeltas();
/**
* Sets the executor which will be used to notify RequestFinished
* listeners, and to notify network quality RTT listeners
* that do not provide an executor.
* TODO(tbansal): http://crbug.com/618034 Remove this API. In short term,
* once all Cronet embedders supply a valid executor with
* NetworkQualityRTTListener, update the above comment to reflect that
* {@link executor} is only used to notify RequestFinishedListeners.
* @hide as it's a prototype.
*/
public abstract void setRequestFinishedListenerExecutor(Executor executor);
/**
* Enables the network quality estimator, which collects and reports
* measurements of round trip time (RTT) and downstream throughput at
* various layers of the network stack. After enabling the estimator,
* listeners of RTT and throughput can be added with
* {@link #addRttListener} and {@link #addThroughputListener} and
* removed with {@link #removeRttListener} and
* {@link #removeThroughputListener}. The estimator uses memory and CPU
* only when enabled.
* @param executor an executor that will be used to notified all
* added RTT and throughput listeners.
* TODO(tbansal): http://crbug.com/618034 Remove this API.
* @hide as it's a prototype.
*/
public abstract void enableNetworkQualityEstimator(Executor executor);
/**
* Configures the network quality estimator for testing. This must be called
* before round trip time and throughput listeners are added, and after the
......@@ -1136,8 +1108,6 @@ public abstract class CronetEngine {
*
* @param listener the listener for finished requests.
*
* TODO(tbansal): http://crbug.com/618034 Remove this API, once all embedders have switched to
* using a request finished listener that provides its own executor.
* @hide as it's a prototype.
*/
public abstract void addRequestFinishedListener(RequestFinishedListener listener);
......@@ -1147,8 +1117,6 @@ public abstract class CronetEngine {
*
* @param listener the listener to remove.
*
* TODO(tbansal): http://crbug.com/618034 Remove this API, once all embedders have switched to
* using a request finished listener that provides its own executor.
* @hide it's a prototype.
*/
public abstract void removeRequestFinishedListener(RequestFinishedListener listener);
......
......@@ -103,12 +103,6 @@ final class JavaCronetEngine extends CronetEngine {
return new byte[0];
}
@Override
public void setRequestFinishedListenerExecutor(Executor executor) {}
@Override
public void enableNetworkQualityEstimator(Executor executor) {}
@Override
public void configureNetworkQualityEstimatorForTesting(
boolean useLocalHostRequests, boolean useSmallerResponses) {}
......
......@@ -467,25 +467,6 @@ void CronetURLRequestContextAdapter::ConfigureNetworkQualityEstimatorForTesting(
use_smaller_responses));
}
void CronetURLRequestContextAdapter::
EnableNetworkQualityEstimatorOnNetworkThread() {
DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
DCHECK(!network_quality_estimator_);
network_quality_estimator_.reset(new net::NetworkQualityEstimator(
std::unique_ptr<net::ExternalEstimateProvider>(),
std::map<std::string, std::string>()));
context_->set_network_quality_estimator(network_quality_estimator_.get());
}
void CronetURLRequestContextAdapter::EnableNetworkQualityEstimator(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
PostTaskToNetworkThread(
FROM_HERE, base::Bind(&CronetURLRequestContextAdapter::
EnableNetworkQualityEstimatorOnNetworkThread,
base::Unretained(this)));
}
void CronetURLRequestContextAdapter::ProvideRTTObservationsOnNetworkThread(
bool should) {
DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
......
......@@ -98,12 +98,6 @@ class CronetURLRequestContextAdapter
// Called on main Java thread to initialize URLRequestContext.
void InitRequestContextOnMainThread();
// Enables the network quality estimator.
// TODO(tbansal): http://crbug.com/618034 Remove this API.
void EnableNetworkQualityEstimator(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller);
// Configures the network quality estimator to observe localhost requests, and
// to consider smaller responses when observing throughput for testing. This
// should be called after the network quality estimator has been enabled.
......@@ -145,10 +139,6 @@ class CronetURLRequestContextAdapter
// Gets the file thread. Create one if there is none.
base::Thread* GetFileThread();
// Instantiate and configure the network quality estimator.
// TODO(tbansal): http://crbug.com/618034 Remove this API.
void EnableNetworkQualityEstimatorOnNetworkThread();
// Configures the network quality estimator to observe requests to localhost,
// as well as to use smaller responses when estimating throughput. This
// should only be used for testing.
......
......@@ -63,7 +63,6 @@ public class CronetUrlRequestContext extends CronetEngine {
private long mUrlRequestContextAdapter = 0;
private Thread mNetworkThread;
private Executor mNetworkQualityExecutor;
private boolean mNetworkQualityEstimatorEnabled;
/**
......@@ -261,46 +260,6 @@ public class CronetUrlRequestContext extends CronetEngine {
return nativeGetHistogramDeltas();
}
/**
* TODO(tbansal): http://crbug.com/618034 Remove this API once all
* embedders have switched to using a request finished listener that
* provides its own executor.
*/
@Override
public void setRequestFinishedListenerExecutor(Executor executor) {
if (!mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator not enabled");
}
if (executor == null) {
throw new NullPointerException("Request finished listener requires an executor");
}
if (mNetworkQualityExecutor != null) {
throw new NullPointerException("Request finished listener executor already set");
}
mNetworkQualityExecutor = executor;
}
/**
* TODO(tbansal): http://crbug.com/618034 Remove this API once all
* embedders have switched to using CronetEngine builder for enabling
* network quality estimator.
*/
@Override
public void enableNetworkQualityEstimator(Executor executor) {
if (mNetworkQualityEstimatorEnabled) {
throw new IllegalStateException("Network quality estimator already enabled");
}
mNetworkQualityEstimatorEnabled = true;
if (executor == null) {
throw new NullPointerException("Network quality estimator requires an executor");
}
mNetworkQualityExecutor = executor;
synchronized (mLock) {
checkHaveAdapter();
nativeEnableNetworkQualityEstimator(mUrlRequestContextAdapter);
}
}
@VisibleForTesting
@Override
public void configureNetworkQualityEstimatorForTesting(
......@@ -379,11 +338,6 @@ public class CronetUrlRequestContext extends CronetEngine {
}
}
/**
* TODO(tbansal): http://crbug.com/618034 Remove this API once all
* embedders have switched to using a request finished listener that
* provides its own executor.
*/
@Override
public void addRequestFinishedListener(RequestFinishedListener listener) {
synchronized (mFinishedListenerLock) {
......@@ -391,9 +345,6 @@ public class CronetUrlRequestContext extends CronetEngine {
}
}
/**
* TODO(tbansal): http://crbug.com/618034 Remove this API.
*/
@Override
public void removeRequestFinishedListener(RequestFinishedListener listener) {
synchronized (mFinishedListenerLock) {
......@@ -591,9 +542,6 @@ public class CronetUrlRequestContext extends CronetEngine {
private native void nativeConfigureNetworkQualityEstimatorForTesting(
long nativePtr, boolean useLocalHostRequests, boolean useSmallerResponses);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeEnableNetworkQualityEstimator(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeProvideRTTObservations(long nativePtr, boolean should);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment