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

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

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: Fix test. Created 3 years, 7 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 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.HandlerThread; 9 import android.os.HandlerThread;
10 import android.os.Looper; 10 import android.os.Looper;
(...skipping 30 matching lines...) Expand all
41 public static void ensureInitialized( 41 public static void ensureInitialized(
42 final Context applicationContext, final CronetEngineBuilderImpl buil der) { 42 final Context applicationContext, final CronetEngineBuilderImpl buil der) {
43 synchronized (sLoadLock) { 43 synchronized (sLoadLock) {
44 if (!sLibraryLoaded) { 44 if (!sLibraryLoaded) {
45 ContextUtils.initApplicationContext(applicationContext); 45 ContextUtils.initApplicationContext(applicationContext);
46 if (builder.libraryLoader() != null) { 46 if (builder.libraryLoader() != null) {
47 builder.libraryLoader().loadLibrary(LIBRARY_NAME); 47 builder.libraryLoader().loadLibrary(LIBRARY_NAME);
48 } else { 48 } else {
49 System.loadLibrary(LIBRARY_NAME); 49 System.loadLibrary(LIBRARY_NAME);
50 } 50 }
51 ContextUtils.initApplicationContextForNative();
52 String implVersion = ImplVersion.getCronetVersion(); 51 String implVersion = ImplVersion.getCronetVersion();
53 if (!implVersion.equals(nativeGetCronetVersion())) { 52 if (!implVersion.equals(nativeGetCronetVersion())) {
54 throw new RuntimeException(String.format("Expected Cronet ve rsion number %s, " 53 throw new RuntimeException(String.format("Expected Cronet ve rsion number %s, "
55 + "actual version number %s.", 54 + "actual version number %s.",
56 implVersion, nativeGetCronetVersion())); 55 implVersion, nativeGetCronetVersion()));
57 } 56 }
58 Log.i(TAG, "Cronet version: %s, arch: %s", implVersion, 57 Log.i(TAG, "Cronet version: %s, arch: %s", implVersion,
59 System.getProperty("os.arch")); 58 System.getProperty("os.arch"));
60 sLibraryLoaded = true; 59 sLibraryLoaded = true;
61 } 60 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 r.run(); 114 r.run();
116 } else { 115 } else {
117 new Handler(sInitThread.getLooper()).post(r); 116 new Handler(sInitThread.getLooper()).post(r);
118 } 117 }
119 } 118 }
120 119
121 // Native methods are implemented in cronet_library_loader.cc. 120 // Native methods are implemented in cronet_library_loader.cc.
122 private static native void nativeCronetInitOnInitThread(); 121 private static native void nativeCronetInitOnInitThread();
123 private static native String nativeGetCronetVersion(); 122 private static native String nativeGetCronetVersion();
124 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698