Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java

Issue 1018213007: Adds @UsedByReflection to the CronetUrlRequestContext constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.Build; 8 import android.os.Build;
9 import android.os.ConditionVariable; 9 import android.os.ConditionVariable;
10 import android.os.Handler; 10 import android.os.Handler;
11 import android.os.Looper; 11 import android.os.Looper;
12 import android.os.Process; 12 import android.os.Process;
13 import android.util.Log; 13 import android.util.Log;
14 14
15 import org.chromium.base.CalledByNative; 15 import org.chromium.base.CalledByNative;
16 import org.chromium.base.JNINamespace; 16 import org.chromium.base.JNINamespace;
17 import org.chromium.base.NativeClassQualifiedName; 17 import org.chromium.base.NativeClassQualifiedName;
18 import org.chromium.base.UsedByReflection;
18 19
19 import java.util.concurrent.Executor; 20 import java.util.concurrent.Executor;
20 import java.util.concurrent.atomic.AtomicInteger; 21 import java.util.concurrent.atomic.AtomicInteger;
21 22
22 /** 23 /**
23 * UrlRequest context using Chromium HTTP stack implementation. 24 * UrlRequest context using Chromium HTTP stack implementation.
24 */ 25 */
25 @JNINamespace("cronet") 26 @JNINamespace("cronet")
27 @UsedByReflection("UrlRequestContext.java")
26 public class CronetUrlRequestContext extends UrlRequestContext { 28 public class CronetUrlRequestContext extends UrlRequestContext {
27 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG. 29 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG.
28 private static final int LOG_DEBUG = -1; // LOG(FATAL...INFO), VLOG(1) 30 private static final int LOG_DEBUG = -1; // LOG(FATAL...INFO), VLOG(1)
29 private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2) 31 private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2)
30 static final String LOG_TAG = "ChromiumNetwork"; 32 static final String LOG_TAG = "ChromiumNetwork";
31 33
32 /** 34 /**
33 * Synchronize access to mUrlRequestContextAdapter and shutdown routine. 35 * Synchronize access to mUrlRequestContextAdapter and shutdown routine.
34 */ 36 */
35 private final Object mLock = new Object(); 37 private final Object mLock = new Object();
36 private final ConditionVariable mInitCompleted = new ConditionVariable(false ); 38 private final ConditionVariable mInitCompleted = new ConditionVariable(false );
37 private final AtomicInteger mActiveRequestCount = new AtomicInteger(0); 39 private final AtomicInteger mActiveRequestCount = new AtomicInteger(0);
38 40
39 private long mUrlRequestContextAdapter = 0; 41 private long mUrlRequestContextAdapter = 0;
40 private Thread mNetworkThread; 42 private Thread mNetworkThread;
41 43
44 @UsedByReflection("UrlRequestContext.java")
42 public CronetUrlRequestContext(Context context, 45 public CronetUrlRequestContext(Context context,
43 UrlRequestContextConfig config) { 46 UrlRequestContextConfig config) {
44 CronetLibraryLoader.ensureInitialized(context, config); 47 CronetLibraryLoader.ensureInitialized(context, config);
45 nativeSetMinLogLevel(getLoggingLevel()); 48 nativeSetMinLogLevel(getLoggingLevel());
46 mUrlRequestContextAdapter = nativeCreateRequestContextAdapter(config.toS tring()); 49 mUrlRequestContextAdapter = nativeCreateRequestContextAdapter(config.toS tring());
47 if (mUrlRequestContextAdapter == 0) { 50 if (mUrlRequestContextAdapter == 0) {
48 throw new NullPointerException("Context Adapter creation failed."); 51 throw new NullPointerException("Context Adapter creation failed.");
49 } 52 }
50 53
51 // Init native Chromium URLRequestContext on main UI thread. 54 // Init native Chromium URLRequestContext on main UI thread.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 207 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
205 private native void nativeStartNetLogToFile(long nativePtr, 208 private native void nativeStartNetLogToFile(long nativePtr,
206 String fileName); 209 String fileName);
207 210
208 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 211 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
209 private native void nativeStopNetLog(long nativePtr); 212 private native void nativeStopNetLog(long nativePtr);
210 213
211 @NativeClassQualifiedName("CronetURLRequestContextAdapter") 214 @NativeClassQualifiedName("CronetURLRequestContextAdapter")
212 private native void nativeInitRequestContextOnMainThread(long nativePtr); 215 private native void nativeInitRequestContextOnMainThread(long nativePtr);
213 } 216 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698