| Index: components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java
|
| diff --git a/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java b/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java
|
| index 813db69beacbecebce23fa9b37d66141ef557c83..02d2555ec3c1f995a1677b2abacc1517d5bc495b 100644
|
| --- a/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java
|
| +++ b/components/cronet/android/java/src/org/chromium/net/impl/CronetEngineBuilderImpl.java
|
| @@ -3,6 +3,8 @@
|
| // found in the LICENSE file.
|
| package org.chromium.net.impl;
|
|
|
| +import static android.os.Process.THREAD_PRIORITY_LOWEST;
|
| +
|
| import android.content.Context;
|
| import android.support.annotation.IntDef;
|
| import android.support.annotation.VisibleForTesting;
|
| @@ -71,6 +73,8 @@ public abstract class CronetEngineBuilderImpl extends ICronetEngineBuilder {
|
|
|
| private static final Pattern INVALID_PKP_HOST_NAME = Pattern.compile("^[0-9\\.]*$");
|
|
|
| + private static final int INVALID_THREAD_PRIORITY = THREAD_PRIORITY_LOWEST + 1;
|
| +
|
| // Private fields are simply storage of configuration for the resulting CronetEngine.
|
| // See setters below for verbose descriptions.
|
| private final Context mApplicationContext;
|
| @@ -91,6 +95,7 @@ public abstract class CronetEngineBuilderImpl extends ICronetEngineBuilder {
|
| protected long mMockCertVerifier;
|
| private boolean mNetworkQualityEstimatorEnabled;
|
| private String mCertVerifierData;
|
| + private int mThreadPriority = INVALID_THREAD_PRIORITY;
|
|
|
| /**
|
| * Default config enables SPDY, disables QUIC, SDCH and HTTP cache.
|
| @@ -387,6 +392,22 @@ public abstract class CronetEngineBuilderImpl extends ICronetEngineBuilder {
|
| return mCertVerifierData;
|
| }
|
|
|
| + @Override
|
| + public CronetEngineBuilderImpl setThreadPriority(int priority) {
|
| + if (priority > THREAD_PRIORITY_LOWEST || priority < -20) {
|
| + throw new IllegalArgumentException("Thread priority invalid");
|
| + }
|
| + mThreadPriority = priority;
|
| + return this;
|
| + }
|
| +
|
| + /**
|
| + * @returns thread priority provided by user, or {@code defaultThreadPriority} if none provided.
|
| + */
|
| + int threadPriority(int defaultThreadPriority) {
|
| + return mThreadPriority == INVALID_THREAD_PRIORITY ? defaultThreadPriority : mThreadPriority;
|
| + }
|
| +
|
| /**
|
| * Returns {@link Context} for builder.
|
| *
|
|
|