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

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

Issue 726013002: [Cronet] Hook up library loader, system proxy and network change notifier to async api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 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; 7 import android.content.Context;
8 import android.os.Build; 8 import android.os.Build;
9 9
10 import org.chromium.base.UsedByReflection; 10 import org.chromium.base.UsedByReflection;
11 11
12 import java.nio.channels.WritableByteChannel; 12 import java.nio.channels.WritableByteChannel;
13 import java.util.Map; 13 import java.util.Map;
14 14
15 /** 15 /**
16 * Network request factory using the native http stack implementation. 16 * Network request factory using the native http stack implementation.
17 */ 17 */
18 @UsedByReflection("HttpUrlRequestFactory.java") 18 @UsedByReflection("HttpUrlRequestFactory.java")
19 public class ChromiumUrlRequestFactory extends HttpUrlRequestFactory { 19 public class ChromiumUrlRequestFactory extends HttpUrlRequestFactory {
20 private ChromiumUrlRequestContext mRequestContext; 20 private ChromiumUrlRequestContext mRequestContext;
21 21
22 @UsedByReflection("HttpUrlRequestFactory.java") 22 @UsedByReflection("HttpUrlRequestFactory.java")
23 public ChromiumUrlRequestFactory( 23 public ChromiumUrlRequestFactory(
24 Context context, UrlRequestContextConfig config) { 24 Context context, UrlRequestContextConfig config) {
25 if (isEnabled()) { 25 if (isEnabled()) {
26 System.loadLibrary(config.libraryName()); 26 CronetLibraryLoader.ensureInitialized(context, config);
27 mRequestContext = new ChromiumUrlRequestContext( 27 mRequestContext = new ChromiumUrlRequestContext(
28 context.getApplicationContext(), UserAgent.from(context), 28 context.getApplicationContext(), UserAgent.from(context),
29 config.toString()); 29 config.toString());
30 } 30 }
31 } 31 }
32 32
33 @Override 33 @Override
34 public boolean isEnabled() { 34 public boolean isEnabled() {
35 return Build.VERSION.SDK_INT >= 14; 35 return Build.VERSION.SDK_INT >= 14;
36 } 36 }
(...skipping 25 matching lines...) Expand all
62 62
63 @Override 63 @Override
64 public void stopNetLog() { 64 public void stopNetLog() {
65 mRequestContext.stopNetLog(); 65 mRequestContext.stopNetLog();
66 } 66 }
67 67
68 public ChromiumUrlRequestContext getRequestContext() { 68 public ChromiumUrlRequestContext getRequestContext() {
69 return mRequestContext; 69 return mRequestContext;
70 } 70 }
71 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698