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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java

Issue 2247143004: Remove app context init from LibraryLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix per review. Created 4 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.StrictMode; 8 import android.os.StrictMode;
9 9
10 import org.chromium.android_webview.policy.AwPolicyProvider; 10 import org.chromium.android_webview.policy.AwPolicyProvider;
(...skipping 27 matching lines...) Expand all
38 /** 38 /**
39 * Loads the native library, and performs basic static construction of objec ts needed 39 * Loads the native library, and performs basic static construction of objec ts needed
40 * to run webview in this process. Does not create threads; safe to call fro m zygote. 40 * to run webview in this process. Does not create threads; safe to call fro m zygote.
41 * Note: it is up to the caller to ensure this is only called once. 41 * Note: it is up to the caller to ensure this is only called once.
42 */ 42 */
43 public static void loadLibrary() { 43 public static void loadLibrary() {
44 Context appContext = ContextUtils.getApplicationContext(); 44 Context appContext = ContextUtils.getApplicationContext();
45 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, a ppContext); 45 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, a ppContext);
46 try { 46 try {
47 LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.P ROCESS_WEBVIEW); 47 LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.P ROCESS_WEBVIEW);
48 libraryLoader.loadNow(appContext); 48 libraryLoader.loadNow();
49 // Switch the command line implementation from Java to native. 49 // Switch the command line implementation from Java to native.
50 // It's okay for the WebView to do this before initialization becaus e we have 50 // It's okay for the WebView to do this before initialization becaus e we have
51 // setup the JNI bindings by this point. 51 // setup the JNI bindings by this point.
52 libraryLoader.switchCommandLineForWebView(); 52 libraryLoader.switchCommandLineForWebView();
53 } catch (ProcessInitException e) { 53 } catch (ProcessInitException e) {
54 throw new RuntimeException("Cannot load WebView", e); 54 throw new RuntimeException("Cannot load WebView", e);
55 } 55 }
56 } 56 }
57 57
58 /** 58 /**
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 if (!success) { 113 if (!success) {
114 Log.w(TAG, "The app may have another WebView opened in a separat e process. " 114 Log.w(TAG, "The app may have another WebView opened in a separat e process. "
115 + "This is not recommended and may stop working in futur e versions."); 115 + "This is not recommended and may stop working in futur e versions.");
116 } 116 }
117 } finally { 117 } finally {
118 StrictMode.setThreadPolicy(oldPolicy); 118 StrictMode.setThreadPolicy(oldPolicy);
119 } 119 }
120 } 120 }
121 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698