Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |