Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.util.Log; | 8 import android.util.Log; |
| 9 | 9 |
| 10 import java.lang.reflect.Constructor; | 10 import java.lang.reflect.Constructor; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 */ | 87 */ |
| 88 public abstract void startNetLogToFile(String fileName, boolean logAll); | 88 public abstract void startNetLogToFile(String fileName, boolean logAll); |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Stops NetLog logging and flushes file to disk. If a logging session is | 91 * Stops NetLog logging and flushes file to disk. If a logging session is |
| 92 * not in progress, this call is ignored. | 92 * not in progress, this call is ignored. |
| 93 */ | 93 */ |
| 94 public abstract void stopNetLog(); | 94 public abstract void stopNetLog(); |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Enables the network quality estimator. This must be called before RTT | |
|
pauljensen
2015/09/01 10:59:10
You abbreviate the first occurrence of RTT but the
bengr
2015/09/01 23:07:39
Done.
| |
| 98 * and throughput observers are added. Set both parameters to false | |
| 99 * for default behavior. | |
| 100 * @param useLocalHostRequests Include requests to localhost in estimates. | |
| 101 * @param useSmallerResponses Include small responses in throughput estimate s. | |
|
pauljensen
2015/09/01 10:59:10
AFAIK these parameters are only for testing. Perh
bengr
2015/09/01 23:07:39
Done.
| |
| 102 */ | |
| 103 public abstract void enableNetworkQualityEstimator( | |
| 104 boolean useLocalHostRequests, boolean useSmallerResponses); | |
| 105 | |
| 106 /** | |
| 107 * Adds an observer of round trip time observations. | |
|
pauljensen
2015/09/01 10:59:10
Please make this more verbose. When and under wha
bengr
2015/09/01 23:07:39
Done.
| |
| 108 * @param observer The observer of round trip times. | |
| 109 */ | |
| 110 public abstract void addRTTObserver(NetworkQualityRTTObserver observer); | |
| 111 | |
| 112 /** | |
| 113 * Removes an observer of round trip times if on the observer list. | |
| 114 * @param observer The observer of round trip times. | |
| 115 */ | |
| 116 public abstract void removeRTTObserver(NetworkQualityRTTObserver observer); | |
| 117 | |
| 118 /** | |
| 119 * Adds an observer of throughout. | |
| 120 * @param observer The observer of throughput. | |
| 121 */ | |
| 122 public abstract void addThroughputObserver(NetworkQualityThroughputObserver observer); | |
| 123 | |
| 124 /** | |
| 125 * Removes an observer of throughput. | |
| 126 * @param observer The observer of throughput. | |
| 127 */ | |
| 128 public abstract void removeThroughputObserver(NetworkQualityThroughputObserv er observer); | |
| 129 | |
| 130 /** | |
| 97 * Creates a {@link UrlRequestContext} with the given | 131 * Creates a {@link UrlRequestContext} with the given |
| 98 * {@link UrlRequestContextConfig}. | 132 * {@link UrlRequestContextConfig}. |
| 99 * @param context Android {@link Context}. | 133 * @param context Android {@link Context}. |
| 100 * @param config context configuration. | 134 * @param config context configuration. |
| 101 */ | 135 */ |
| 102 public static UrlRequestContext createContext(Context context, | 136 public static UrlRequestContext createContext(Context context, |
| 103 UrlRequestContextConfig config) { | 137 UrlRequestContextConfig config) { |
| 104 UrlRequestContext urlRequestContext = null; | 138 UrlRequestContext urlRequestContext = null; |
| 105 if (config.userAgent().isEmpty()) { | 139 if (config.userAgent().isEmpty()) { |
| 106 config.setUserAgent(UserAgent.from(context)); | 140 config.setUserAgent(UserAgent.from(context)); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 137 } catch (ClassNotFoundException e) { | 171 } catch (ClassNotFoundException e) { |
| 138 // Leave as null. | 172 // Leave as null. |
| 139 } catch (Exception e) { | 173 } catch (Exception e) { |
| 140 throw new IllegalStateException( | 174 throw new IllegalStateException( |
| 141 "Cannot instantiate: " + CRONET_URL_REQUEST_CONTEXT, | 175 "Cannot instantiate: " + CRONET_URL_REQUEST_CONTEXT, |
| 142 e); | 176 e); |
| 143 } | 177 } |
| 144 return urlRequestContext; | 178 return urlRequestContext; |
| 145 } | 179 } |
| 146 } | 180 } |
| OLD | NEW |