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

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

Issue 1363723002: [Cronet] Create Builders, rename UrlRequestContext to CronetEngine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: null-check UrlRequest.Builder() Created 5 years, 2 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
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;
8 import android.os.Handler; 7 import android.os.Handler;
9 import android.os.Looper; 8 import android.os.Looper;
10 import android.os.Process; 9 import android.os.Process;
11 import android.util.Log; 10 import android.util.Log;
12 11
13 import org.chromium.base.annotations.CalledByNative; 12 import org.chromium.base.annotations.CalledByNative;
14 import org.chromium.base.annotations.JNINamespace; 13 import org.chromium.base.annotations.JNINamespace;
15 14
16 /** 15 /**
17 * Provides context for the native HTTP operations. 16 * Provides context for the native HTTP operations.
18 * @deprecated Use {@link CronetUrlRequestContext} instead. 17 * @deprecated Use {@link CronetUrlRequestContext} instead.
19 */ 18 */
20 @JNINamespace("cronet") 19 @JNINamespace("cronet")
21 @Deprecated 20 @Deprecated
22 public class ChromiumUrlRequestContext { 21 public class ChromiumUrlRequestContext {
23 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG. 22 private static final int LOG_NONE = 3; // LOG(FATAL), no VLOG.
24 private static final int LOG_DEBUG = -1; // LOG(FATAL...INFO), VLOG(1) 23 private static final int LOG_DEBUG = -1; // LOG(FATAL...INFO), VLOG(1)
25 private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2) 24 private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2)
26 static final String LOG_TAG = "ChromiumNetwork"; 25 static final String LOG_TAG = "ChromiumNetwork";
27 26
28 /** 27 /**
29 * Native adapter object, owned by ChromiumUrlRequestContext. 28 * Native adapter object, owned by ChromiumUrlRequestContext.
30 */ 29 */
31 private long mChromiumUrlRequestContextAdapter; 30 private long mChromiumUrlRequestContextAdapter;
32 31
33 /** 32 /**
34 * Constructor. 33 * Constructor.
35 */ 34 */
36 protected ChromiumUrlRequestContext( 35 protected ChromiumUrlRequestContext(String userAgent, CronetEngine.Builder b uilder) {
37 final Context context, String userAgent, UrlRequestContextConfig con fig) { 36 CronetLibraryLoader.ensureInitialized(builder);
38 CronetLibraryLoader.ensureInitialized(context, config);
39 mChromiumUrlRequestContextAdapter = 37 mChromiumUrlRequestContextAdapter =
40 nativeCreateRequestContextAdapter(userAgent, getLoggingLevel(), config.toString()); 38 nativeCreateRequestContextAdapter(userAgent, getLoggingLevel(), builder.toString());
41 if (mChromiumUrlRequestContextAdapter == 0) { 39 if (mChromiumUrlRequestContextAdapter == 0) {
42 throw new NullPointerException("Context Adapter creation failed"); 40 throw new NullPointerException("Context Adapter creation failed");
43 } 41 }
44 // Post a task to UI thread to init native Chromium URLRequestContext. 42 // Post a task to UI thread to init native Chromium URLRequestContext.
45 // TODO(xunjieli): This constructor is not supposed to be invoked on 43 // TODO(xunjieli): This constructor is not supposed to be invoked on
46 // the main thread. Consider making the following code into a blocking 44 // the main thread. Consider making the following code into a blocking
47 // API to handle the case where we are already on main thread. 45 // API to handle the case where we are already on main thread.
48 Runnable task = new Runnable() { 46 Runnable task = new Runnable() {
49 public void run() { 47 public void run() {
50 nativeInitRequestContextOnMainThread( 48 nativeInitRequestContextOnMainThread(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 149
152 private native void nativeStartNetLogToFile( 150 private native void nativeStartNetLogToFile(
153 long chromiumUrlRequestContextAdapter, String fileName, 151 long chromiumUrlRequestContextAdapter, String fileName,
154 boolean logAll); 152 boolean logAll);
155 153
156 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); 154 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter);
157 155
158 private native void nativeInitRequestContextOnMainThread( 156 private native void nativeInitRequestContextOnMainThread(
159 long chromiumUrlRequestContextAdapter); 157 long chromiumUrlRequestContextAdapter);
160 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698