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

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

Issue 2020373002: [Cronet] Call System.loadLibrary() from impl not API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implpack
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 | « components/cronet/android/api/src/org/chromium/net/CronetEngine.java ('k') | 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.impl; 5 package org.chromium.net.impl;
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 10
(...skipping 23 matching lines...) Expand all
34 * any thread, the load and initialization is performed on main thread. 34 * any thread, the load and initialization is performed on main thread.
35 */ 35 */
36 public static void ensureInitialized( 36 public static void ensureInitialized(
37 final Context context, final CronetEngine.Builder builder) { 37 final Context context, final CronetEngine.Builder builder) {
38 synchronized (sLoadLock) { 38 synchronized (sLoadLock) {
39 if (sInitStarted) { 39 if (sInitStarted) {
40 return; 40 return;
41 } 41 }
42 sInitStarted = true; 42 sInitStarted = true;
43 ContextUtils.initApplicationContext(context.getApplicationContext()) ; 43 ContextUtils.initApplicationContext(context.getApplicationContext()) ;
44 builder.loadLibrary(); 44 if (builder.libraryLoader() != null) {
45 builder.libraryLoader().loadLibrary(builder.libraryName());
kapishnikov 2016/06/02 16:33:38 If the client passes the custom library loader but
pauljensen 2016/07/22 14:18:04 Ya, we'll probably want to @hide CronetEngine.setL
pauljensen 2016/07/22 14:18:42 I should mention I added this to my TODO list for
46 } else {
47 System.loadLibrary(builder.libraryName());
48 }
45 ContextUtils.initApplicationContextForNative(); 49 ContextUtils.initApplicationContextForNative();
46 if (!ImplVersion.CRONET_VERSION.equals(nativeGetCronetVersion())) { 50 if (!ImplVersion.CRONET_VERSION.equals(nativeGetCronetVersion())) {
47 throw new RuntimeException(String.format("Expected Cronet versio n number %s, " 51 throw new RuntimeException(String.format("Expected Cronet versio n number %s, "
48 + "actual version number %s.", 52 + "actual version number %s.",
49 ImplVersion.CRONET_VERSION, nativeGetCronetVersion())); 53 ImplVersion.CRONET_VERSION, nativeGetCronetVersion()));
50 } 54 }
51 Log.i(TAG, "Cronet version: %s, arch: %s", ImplVersion.CRONET_VERSIO N, 55 Log.i(TAG, "Cronet version: %s, arch: %s", ImplVersion.CRONET_VERSIO N,
52 System.getProperty("os.arch")); 56 System.getProperty("os.arch"));
53 // Init native Chromium CronetEngine on Main UI thread. 57 // Init native Chromium CronetEngine on Main UI thread.
54 Runnable task = new Runnable() { 58 Runnable task = new Runnable() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // the undesired initial network change observer notification, which 95 // the undesired initial network change observer notification, which
92 // will cause active requests to fail with ERR_NETWORK_CHANGED. 96 // will cause active requests to fail with ERR_NETWORK_CHANGED.
93 nativeCronetInitOnMainThread(); 97 nativeCronetInitOnMainThread();
94 sMainThreadInitDone = true; 98 sMainThreadInitDone = true;
95 } 99 }
96 100
97 // Native methods are implemented in cronet_library_loader.cc. 101 // Native methods are implemented in cronet_library_loader.cc.
98 private static native void nativeCronetInitOnMainThread(); 102 private static native void nativeCronetInitOnMainThread();
99 private static native String nativeGetCronetVersion(); 103 private static native String nativeGetCronetVersion();
100 } 104 }
OLDNEW
« no previous file with comments | « components/cronet/android/api/src/org/chromium/net/CronetEngine.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698