Commit a6cb108d authored by Tarun Bansal's avatar Tarun Bansal Committed by Commit Bot

Remove data reduction proxy enabled check for preconnect

To speed up page loads from CCTs, data reduction proxy enabled check  is
removed from preconnect.

Bug: 850609
Change-Id: I111bc05c453a54c4c6d200186c04876faaec063e
TBR: lizeb@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/1264075Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597181}
parent 95d304a7
...@@ -27,7 +27,6 @@ import org.chromium.base.library_loader.LibraryLoader; ...@@ -27,7 +27,6 @@ import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.AsyncTask; import org.chromium.base.task.AsyncTask;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.widget.ControlContainer; import org.chromium.chrome.browser.widget.ControlContainer;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
...@@ -246,17 +245,15 @@ public final class WarmupManager { ...@@ -246,17 +245,15 @@ public final class WarmupManager {
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
/** Launches a background DNS query for a given URL if the data reduction proxy is not in use. /** Launches a background DNS query for a given URL.
* *
* @param context The Application context. * @param context The Application context.
* @param url URL from which the domain to query is extracted. * @param url URL from which the domain to query is extracted.
*/ */
public void maybePrefetchDnsForUrlInBackground(Context context, String url) { public void maybePrefetchDnsForUrlInBackground(Context context, String url) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
if (!DataReductionProxySettings.isEnabledBeforeNativeLoad(context)) {
prefetchDnsForUrlInBackground(url); prefetchDnsForUrlInBackground(url);
} }
}
/** /**
* Starts asynchronous initialization of the preconnect predictor. * Starts asynchronous initialization of the preconnect predictor.
...@@ -282,10 +279,7 @@ public final class WarmupManager { ...@@ -282,10 +279,7 @@ public final class WarmupManager {
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (uri == null) return; if (uri == null) return;
String scheme = uri.normalizeScheme().getScheme(); String scheme = uri.normalizeScheme().getScheme();
boolean isHttp = UrlConstants.HTTP_SCHEME.equals(scheme); if (!UrlConstants.HTTP_SCHEME.equals(scheme) && !UrlConstants.HTTPS_SCHEME.equals(scheme)) {
if (!isHttp && !UrlConstants.HTTPS_SCHEME.equals(scheme)) return;
// HTTP connections will not be used when the data reduction proxy is enabled.
if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled() && isHttp) {
return; return;
} }
......
...@@ -77,28 +77,6 @@ public class DataReductionProxySettings { ...@@ -77,28 +77,6 @@ public class DataReductionProxySettings {
private Callback<List<DataReductionDataUseItem>> mQueryDataUsageCallback; private Callback<List<DataReductionDataUseItem>> mQueryDataUsageCallback;
/**
* Returns whether the data reduction proxy is enabled.
*
* The knowledge of the data reduction proxy status is needed before the
* native library is loaded.
*
* Note that the returned value can be out-of-date if the Data Reduction
* Proxy is enabled/disabled from the native side without going through the
* UI. The discrepancy will however be fixed at the next launch, so the
* value returned here can be wrong (both false-positive and false-negative)
* right after such a change.
*
* @param context The application context.
* @return Whether the data reduction proxy is enabled.
*/
public static boolean isEnabledBeforeNativeLoad(Context context) {
// TODO(lizeb): Add a listener for the native preference change to keep
// both in sync and avoid the false-positives and false-negatives.
return ContextUtils.getAppSharedPreferences().getBoolean(
DATA_REDUCTION_ENABLED_PREF, false);
}
/** /**
* Handles calls for data reduction proxy initialization that need to happen after the native * Handles calls for data reduction proxy initialization that need to happen after the native
* library has been loaded. * library has been loaded.
......
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