This source file includes following definitions.
- JNINamespace
- getVersion
- initNetworkThread
- finalize
- getUrlRequestContextPeer
- nativeGetVersion
- nativeCreateRequestContextPeer
- nativeReleaseRequestContextPeer
package org.chromium.net;
import android.content.Context;
import android.os.ConditionVariable;
import android.os.Process;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
@JNINamespace("net")
public class UrlRequestContext {
protected static final int LOG_NONE = 0;
protected static final int LOG_DEBUG = 1;
protected static final int LOG_VERBOSE = 2;
private long mUrlRequestContextPeer;
private final ConditionVariable mStarted = new ConditionVariable();
protected UrlRequestContext(Context context, String userAgent,
int loggingLevel) {
mUrlRequestContextPeer = nativeCreateRequestContextPeer(context,
userAgent, loggingLevel);
mStarted.block(2000);
}
public static String getVersion() {
return nativeGetVersion();
}
@CalledByNative
private void initNetworkThread() {
Thread.currentThread().setName("ChromiumNet");
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
mStarted.open();
}
@Override
protected void finalize() throws Throwable {
nativeReleaseRequestContextPeer(mUrlRequestContextPeer);
super.finalize();
}
protected long getUrlRequestContextPeer() {
return mUrlRequestContextPeer;
}
private static native String nativeGetVersion();
private native long nativeCreateRequestContextPeer(Context context,
String userAgent, int loggingLevel);
private native void nativeReleaseRequestContextPeer(
long urlRequestContextPeer);
}