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

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: Rebase and fix build 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.ConditionVariable; 8 import android.os.ConditionVariable;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.os.HandlerThread; 10 import android.os.HandlerThread;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 }); 57 });
58 } 58 }
59 if (!sLibraryLoaded) { 59 if (!sLibraryLoaded) {
60 ContextUtils.initApplicationContext(applicationContext); 60 ContextUtils.initApplicationContext(applicationContext);
61 if (builder.libraryLoader() != null) { 61 if (builder.libraryLoader() != null) {
62 builder.libraryLoader().loadLibrary(LIBRARY_NAME); 62 builder.libraryLoader().loadLibrary(LIBRARY_NAME);
63 } else { 63 } else {
64 System.loadLibrary(LIBRARY_NAME); 64 System.loadLibrary(LIBRARY_NAME);
65 } 65 }
66 ContextUtils.initApplicationContextForNative();
67 String implVersion = ImplVersion.getCronetVersion(); 66 String implVersion = ImplVersion.getCronetVersion();
68 if (!implVersion.equals(nativeGetCronetVersion())) { 67 if (!implVersion.equals(nativeGetCronetVersion())) {
69 throw new RuntimeException(String.format("Expected Cronet ve rsion number %s, " 68 throw new RuntimeException(String.format("Expected Cronet ve rsion number %s, "
70 + "actual version number %s.", 69 + "actual version number %s.",
71 implVersion, nativeGetCronetVersion())); 70 implVersion, nativeGetCronetVersion()));
72 } 71 }
73 Log.i(TAG, "Cronet version: %s, arch: %s", implVersion, 72 Log.i(TAG, "Cronet version: %s, arch: %s", implVersion,
74 System.getProperty("os.arch")); 73 System.getProperty("os.arch"));
75 sLibraryLoaded = true; 74 sLibraryLoaded = true;
76 sWaitForLibLoad.open(); 75 sWaitForLibLoad.open();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 r.run(); 120 r.run();
122 } else { 121 } else {
123 new Handler(sInitThread.getLooper()).post(r); 122 new Handler(sInitThread.getLooper()).post(r);
124 } 123 }
125 } 124 }
126 125
127 // Native methods are implemented in cronet_library_loader.cc. 126 // Native methods are implemented in cronet_library_loader.cc.
128 private static native void nativeCronetInitOnInitThread(); 127 private static native void nativeCronetInitOnInitThread();
129 private static native String nativeGetCronetVersion(); 128 private static native String nativeGetCronetVersion();
130 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698