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.os.ConditionVariable; | 8 import android.os.ConditionVariable; |
9 import android.os.Process; | 9 import android.os.Process; |
10 import android.util.Log; | 10 import android.util.Log; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
82 * Stops NetLog logging and flushes file to disk. If a logging session is | 82 * Stops NetLog logging and flushes file to disk. If a logging session is |
83 * not in progress this call is ignored. | 83 * not in progress this call is ignored. |
84 */ | 84 */ |
85 public void stopNetLog() { | 85 public void stopNetLog() { |
86 nativeStopNetLog(mChromiumUrlRequestContextAdapter); | 86 nativeStopNetLog(mChromiumUrlRequestContextAdapter); |
87 } | 87 } |
88 | 88 |
89 /** | |
90 * Explicitly mark |server| as supporting QUIC with given |probability|. | |
91 * Note that DISK CACHE must be enabled to take advantage or 0RTT QUIC. | |
92 * | |
93 * @param server URL of the server that supports QUIC | |
94 * @param alternatePort to use for QUIC | |
95 * @param probability that server supports QUIC (0..1) | |
mmenke
2014/09/05 17:20:34
This seems like a bad idea to me.
mef
2014/09/05 18:15:42
Done.
| |
96 */ | |
97 public void setSupportsQuic(String server, | |
mmenke
2014/09/05 17:20:33
Suggest calling this setQuicHint, which leaves a b
mmenke
2014/09/05 17:20:34
I strongly suggest we throw an exception if |serve
mef
2014/09/05 18:15:42
Done.
mef
2014/09/05 18:15:42
Done.
Charles
2014/09/05 18:16:22
This isn't very useful, as API goes - a normal use
mef
2014/09/05 19:07:28
Acknowledged. This is geared towards advanced user
| |
98 int alternatePort, | |
99 float probability) { | |
100 nativeSetSupportsQuic(mChromiumUrlRequestContextAdapter, server, | |
101 alternatePort, probability); | |
102 } | |
103 | |
89 @CalledByNative | 104 @CalledByNative |
90 private void initNetworkThread() { | 105 private void initNetworkThread() { |
91 Thread.currentThread().setName("ChromiumNet"); | 106 Thread.currentThread().setName("ChromiumNet"); |
92 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); | 107 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); |
93 mStarted.open(); | 108 mStarted.open(); |
94 } | 109 } |
95 | 110 |
96 @Override | 111 @Override |
97 protected void finalize() throws Throwable { | 112 protected void finalize() throws Throwable { |
98 nativeReleaseRequestContextAdapter(mChromiumUrlRequestContextAdapter); | 113 nativeReleaseRequestContextAdapter(mChromiumUrlRequestContextAdapter); |
(...skipping 19 matching lines...) Expand all Loading... | |
118 } | 133 } |
119 return loggingLevel; | 134 return loggingLevel; |
120 } | 135 } |
121 | 136 |
122 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in | 137 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in |
123 // mChromiumUrlRequestContextAdapter. | 138 // mChromiumUrlRequestContextAdapter. |
124 private native long nativeCreateRequestContextAdapter(Context context, | 139 private native long nativeCreateRequestContextAdapter(Context context, |
125 String userAgent, int loggingLevel, String config); | 140 String userAgent, int loggingLevel, String config); |
126 | 141 |
127 private native void nativeReleaseRequestContextAdapter( | 142 private native void nativeReleaseRequestContextAdapter( |
128 long ChromiumUrlRequestContextAdapter); | 143 long chromiumUrlRequestContextAdapter); |
129 | 144 |
130 private native void nativeInitializeStatistics(); | 145 private native void nativeInitializeStatistics(); |
131 | 146 |
132 private native String nativeGetStatisticsJSON(String filter); | 147 private native String nativeGetStatisticsJSON(String filter); |
133 | 148 |
134 private native void nativeStartNetLogToFile( | 149 private native void nativeStartNetLogToFile( |
135 long ChromiumUrlRequestContextAdapter, String fileName); | 150 long chromiumUrlRequestContextAdapter, String fileName); |
136 | 151 |
137 private native void nativeStopNetLog(long ChromiumUrlRequestContextAdapter); | 152 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); |
153 | |
154 private native void nativeSetSupportsQuic( | |
155 long chromiumUrlRequestContextAdapter, String server, | |
156 int alternatePort, float probability); | |
138 } | 157 } |
OLD | NEW |