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

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: sync Created 4 years, 5 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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.Context; 8 import android.content.Context;
9 import android.net.http.HttpResponseCache; 9 import android.net.http.HttpResponseCache;
10 import android.support.annotation.IntDef; 10 import android.support.annotation.IntDef;
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 * 1100 *
1101 * @return an {@link URLStreamHandlerFactory} instance implemented by this 1101 * @return an {@link URLStreamHandlerFactory} instance implemented by this
1102 * CronetEngine. 1102 * CronetEngine.
1103 */ 1103 */
1104 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory(); 1104 public abstract URLStreamHandlerFactory createURLStreamHandlerFactory();
1105 1105
1106 private static CronetEngine createCronetEngine(Builder builder) { 1106 private static CronetEngine createCronetEngine(Builder builder) {
1107 CronetEngine cronetEngine = null; 1107 CronetEngine cronetEngine = null;
1108 try { 1108 try {
1109 Class<? extends CronetEngine> engineClass = 1109 Class<? extends CronetEngine> engineClass =
1110 CronetEngine.class.getClassLoader() 1110 builder.getContext()
1111 .getClassLoader()
1111 .loadClass(CRONET_URL_REQUEST_CONTEXT) 1112 .loadClass(CRONET_URL_REQUEST_CONTEXT)
1112 .asSubclass(CronetEngine.class); 1113 .asSubclass(CronetEngine.class);
1113 Constructor<? extends CronetEngine> constructor = 1114 Constructor<? extends CronetEngine> constructor =
1114 engineClass.getConstructor(Builder.class); 1115 engineClass.getConstructor(Builder.class);
1115 CronetEngine possibleEngine = constructor.newInstance(builder); 1116 CronetEngine possibleEngine = constructor.newInstance(builder);
1116 if (possibleEngine.isEnabled()) { 1117 if (possibleEngine.isEnabled()) {
1117 cronetEngine = possibleEngine; 1118 cronetEngine = possibleEngine;
1118 } 1119 }
1119 } catch (ClassNotFoundException e) { 1120 } catch (ClassNotFoundException e) {
1120 // Leave as null. 1121 // Leave as null.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 * @hide as it's a prototype. 1277 * @hide as it's a prototype.
1277 */ 1278 */
1278 public interface RequestFinishedListener { 1279 public interface RequestFinishedListener {
1279 /** 1280 /**
1280 * Invoked with request info. 1281 * Invoked with request info.
1281 * @param requestInfo {@link UrlRequestInfo} for finished request. 1282 * @param requestInfo {@link UrlRequestInfo} for finished request.
1282 */ 1283 */
1283 void onRequestFinished(UrlRequestInfo requestInfo); 1284 void onRequestFinished(UrlRequestInfo requestInfo);
1284 } 1285 }
1285 } 1286 }
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