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

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

Issue 1429863008: [Cronet] Remove JSON serialization of CronetEngine.Builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix component_unittests Created 5 years 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; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.os.Looper; 9 import android.os.Looper;
10 import android.os.Process; 10 import android.os.Process;
(...skipping 18 matching lines...) Expand all
29 * Native adapter object, owned by ChromiumUrlRequestContext. 29 * Native adapter object, owned by ChromiumUrlRequestContext.
30 */ 30 */
31 private long mChromiumUrlRequestContextAdapter; 31 private long mChromiumUrlRequestContextAdapter;
32 32
33 /** 33 /**
34 * Constructor. 34 * Constructor.
35 */ 35 */
36 protected ChromiumUrlRequestContext( 36 protected ChromiumUrlRequestContext(
37 final Context context, String userAgent, CronetEngine.Builder config ) { 37 final Context context, String userAgent, CronetEngine.Builder config ) {
38 CronetLibraryLoader.ensureInitialized(context, config); 38 CronetLibraryLoader.ensureInitialized(context, config);
39 mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter( 39 mChromiumUrlRequestContextAdapter =
40 userAgent, getLoggingLevel(), config.toJSONString()); 40 nativeCreateRequestContextAdapter(userAgent, getLoggingLevel(),
41 CronetUrlRequestContext.createNativeUrlRequestContextCon fig(config));
41 if (mChromiumUrlRequestContextAdapter == 0) { 42 if (mChromiumUrlRequestContextAdapter == 0) {
42 throw new NullPointerException("Context Adapter creation failed"); 43 throw new NullPointerException("Context Adapter creation failed");
43 } 44 }
44 // Post a task to UI thread to init native Chromium URLRequestContext. 45 // Post a task to UI thread to init native Chromium URLRequestContext.
45 // TODO(xunjieli): This constructor is not supposed to be invoked on 46 // TODO(xunjieli): This constructor is not supposed to be invoked on
46 // the main thread. Consider making the following code into a blocking 47 // the main thread. Consider making the following code into a blocking
47 // API to handle the case where we are already on main thread. 48 // API to handle the case where we are already on main thread.
48 Runnable task = new Runnable() { 49 Runnable task = new Runnable() {
49 public void run() { 50 public void run() {
50 nativeInitRequestContextOnMainThread( 51 nativeInitRequestContextOnMainThread(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 loggingLevel = LOG_DEBUG; 134 loggingLevel = LOG_DEBUG;
134 } else { 135 } else {
135 loggingLevel = LOG_NONE; 136 loggingLevel = LOG_NONE;
136 } 137 }
137 return loggingLevel; 138 return loggingLevel;
138 } 139 }
139 140
140 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in 141 // Returns an instance ChromiumUrlRequestContextAdapter to be stored in
141 // mChromiumUrlRequestContextAdapter. 142 // mChromiumUrlRequestContextAdapter.
142 private native long nativeCreateRequestContextAdapter( 143 private native long nativeCreateRequestContextAdapter(
143 String userAgent, int loggingLevel, String config); 144 String userAgent, int loggingLevel, long config);
144 145
145 private native void nativeReleaseRequestContextAdapter( 146 private native void nativeReleaseRequestContextAdapter(
146 long chromiumUrlRequestContextAdapter); 147 long chromiumUrlRequestContextAdapter);
147 148
148 private native void nativeInitializeStatistics(); 149 private native void nativeInitializeStatistics();
149 150
150 private native String nativeGetStatisticsJSON(String filter); 151 private native String nativeGetStatisticsJSON(String filter);
151 152
152 private native void nativeStartNetLogToFile( 153 private native void nativeStartNetLogToFile(
153 long chromiumUrlRequestContextAdapter, String fileName, 154 long chromiumUrlRequestContextAdapter, String fileName,
154 boolean logAll); 155 boolean logAll);
155 156
156 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter); 157 private native void nativeStopNetLog(long chromiumUrlRequestContextAdapter);
157 158
158 private native void nativeInitRequestContextOnMainThread( 159 private native void nativeInitRequestContextOnMainThread(
159 long chromiumUrlRequestContextAdapter); 160 long chromiumUrlRequestContextAdapter);
160 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698