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

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

Issue 1981793002: [Cronet] Use Context's ClassLoader to load Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.net.http.HttpResponseCache; 8 import android.net.http.HttpResponseCache;
9 import android.support.annotation.IntDef; 9 import android.support.annotation.IntDef;
10 import android.support.annotation.Nullable; 10 import android.support.annotation.Nullable;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 cronetEngine = new JavaCronetEngine(builder.getUserAgent()); 1003 cronetEngine = new JavaCronetEngine(builder.getUserAgent());
1004 } 1004 }
1005 Log.i(TAG, "Using network stack: " + cronetEngine.getVersionString()); 1005 Log.i(TAG, "Using network stack: " + cronetEngine.getVersionString());
1006 return cronetEngine; 1006 return cronetEngine;
1007 } 1007 }
1008 1008
1009 private static CronetEngine createCronetEngine(Builder builder) { 1009 private static CronetEngine createCronetEngine(Builder builder) {
1010 CronetEngine cronetEngine = null; 1010 CronetEngine cronetEngine = null;
1011 try { 1011 try {
1012 Class<? extends CronetEngine> engineClass = 1012 Class<? extends CronetEngine> engineClass =
1013 CronetEngine.class.getClassLoader() 1013 builder.getContext()
kapishnikov 2016/06/02 16:17:47 Is it the same context that is supplied in the con
pauljensen 2016/06/03 13:24:30 Yes
1014 .getClassLoader()
1014 .loadClass(CRONET_URL_REQUEST_CONTEXT) 1015 .loadClass(CRONET_URL_REQUEST_CONTEXT)
1015 .asSubclass(CronetEngine.class); 1016 .asSubclass(CronetEngine.class);
1016 Constructor<? extends CronetEngine> constructor = 1017 Constructor<? extends CronetEngine> constructor =
1017 engineClass.getConstructor(Builder.class); 1018 engineClass.getConstructor(Builder.class);
1018 CronetEngine possibleEngine = constructor.newInstance(builder); 1019 CronetEngine possibleEngine = constructor.newInstance(builder);
1019 if (possibleEngine.isEnabled()) { 1020 if (possibleEngine.isEnabled()) {
1020 cronetEngine = possibleEngine; 1021 cronetEngine = possibleEngine;
1021 } 1022 }
1022 } catch (ClassNotFoundException e) { 1023 } catch (ClassNotFoundException e) {
1023 // Leave as null. 1024 // Leave as null.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 * @hide as it's a prototype. 1174 * @hide as it's a prototype.
1174 */ 1175 */
1175 public interface RequestFinishedListener { // TODO(klm): Add a convenience a bstract class. 1176 public interface RequestFinishedListener { // TODO(klm): Add a convenience a bstract class.
1176 /** 1177 /**
1177 * Invoked with request info. 1178 * Invoked with request info.
1178 * @param requestInfo {@link UrlRequestInfo} for finished request. 1179 * @param requestInfo {@link UrlRequestInfo} for finished request.
1179 */ 1180 */
1180 void onRequestFinished(UrlRequestInfo requestInfo); 1181 void onRequestFinished(UrlRequestInfo requestInfo);
1181 } 1182 }
1182 } 1183 }
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