| 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. |
| 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 */ |
| 96 public void setQuicHint(String server, int alternatePort) { |
| 97 if (!nativeSetQuicHint(mChromiumUrlRequestContextAdapter, server, |
| 98 alternatePort)) { |
| 99 throw new IllegalArgumentException("Invalid server URL: " + server); |
| 100 } |
| 101 } |
| 102 |
| 89 @CalledByNative | 103 @CalledByNative |
| 90 private void initNetworkThread() { | 104 private void initNetworkThread() { |
| 91 Thread.currentThread().setName("ChromiumNet"); | 105 Thread.currentThread().setName("ChromiumNet"); |
| 92 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); | 106 Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); |
| 93 mStarted.open(); | 107 mStarted.open(); |
| 94 } | 108 } |
| 95 | 109 |
| 96 @Override | 110 @Override |
| 97 protected void finalize() throws Throwable { | 111 protected void finalize() throws Throwable { |
| 98 nativeReleaseRequestContextAdapter(mChromiumUrlRequestContextAdapter); | 112 nativeReleaseRequestContextAdapter(mChromiumUrlRequestContextAdapter); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 118 } | 132 } |
| 119 return loggingLevel; | 133 return loggingLevel; |
| 120 } | 134 } |
| 121 | 135 |
| 122 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in | 136 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in |
| 123 // mChromiumUrlRequestContextAdapter. | 137 // mChromiumUrlRequestContextAdapter. |
| 124 private native long nativeCreateRequestContextAdapter(Context context, | 138 private native long nativeCreateRequestContextAdapter(Context context, |
| 125 String userAgent, int loggingLevel, String config); | 139 String userAgent, int loggingLevel, String config); |
| 126 | 140 |
| 127 private native void nativeReleaseRequestContextAdapter( | 141 private native void nativeReleaseRequestContextAdapter( |
| 128 long ChromiumUrlRequestContextAdapter); | 142 long chromiumUrlRequestContextAdapter); |
| 129 | 143 |
| 130 private native void nativeInitializeStatistics(); | 144 private native void nativeInitializeStatistics(); |
| 131 | 145 |
| 132 private native String nativeGetStatisticsJSON(String filter); | 146 private native String nativeGetStatisticsJSON(String filter); |
| 133 | 147 |
| 134 private native void nativeStartNetLogToFile( | 148 private native void nativeStartNetLogToFile( |
| 135 long ChromiumUrlRequestContextAdapter, String fileName); | 149 long chromiumUrlRequestContextAdapter, String fileName); |
| 136 | 150 |
| 137 private native void nativeStopNetLog(long ChromiumUrlRequestContextAdapter); | 151 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); |
| 152 |
| 153 private native boolean nativeSetQuicHint( |
| 154 long chromiumUrlRequestContextAdapter, String server, |
| 155 int alternatePort); |
| 138 } | 156 } |
| OLD | NEW |